# [PATCH] include_once/require_once core dump

- Thread: https://externals.io/message/1746
- Original archive: https://news-web.php.net/php.internals/1746
- Started by Brian J. France on 2003-05-20T00:31:23+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #1749 — Sterling Hughes — 2003-05-19T23:32:59+00:00

URL: https://externals.io/message/1746#1749 · In reply to: #1748

Your test script works fine for me.

-Sterling


> <?PHP
>   include_once( "foo.php" );
> ?>
> 
> Since foo.php doesn't exists, zend_open will fail and then try to send a 
> warning message using file_handle.filename.  Since zend_open failed 
> file_handle.filename will still be in its initial state of "file_handle = 
> {0}".  zend_message_dispatcher is called with file_handle.filename, which 
> calls php_message_handler_for_zend, which calls php_strip_url_passwd, which 
> core dumps because *file_handle.filename is a bad address.
> 
> Brian
> 
> 
> > […]
-- 
"The computer programmer is a creator of universes for which he  
 alone is responsible. Universes of virtually unlimited complexity  
 can be created in the form of computer programs." 
    - Joseph Weizenbaum

---

## #1751 — Sterling Hughes — 2003-05-19T23:40:18+00:00

URL: https://externals.io/message/1746#1751 · In reply to: #1750

> Did you get a warning that foo.php couldn't be included?  If not try to 
> include_once a file that doesn't exists.  The patch is for PHP_4_3 and not cvs 
> head.
> 

Ok, I just tried with CVS head.

-Sterling
-- 
"Whether you think you can or think you can't -- you are right." 
    - Henry Ford

---

## #1746 — Brian J. France — 2003-05-20T00:31:23+00:00

URL: https://externals.io/message/1746#1746

Can somebody with karma check in the following patch?

If zend_open fails for require_once or include_oncde, file_handle is
not defined and can't be used for the error/warning message.
Changed to inc_filename->value.str.val which is what is passed to zend_open.

Thanks,

Brian

---

## #1747 — Jani Taskinen — 2003-05-20T00:46:14+00:00

URL: https://externals.io/message/1746#1747 · In reply to: #1746

Any example code?
    
    --Jani
    



>Can somebody with karma check in the following patch?
>
>If zend_open fails for require_once or include_oncde, file_handle is
>not defined and can't be used for the error/warning message.
>Changed to inc_filename->value.str.val which is what is passed to zend_open.
>
>Thanks,
>
>Brian
>
>

-- 
<- For Sale!

---

## #1748 — Brian J. France — 2003-05-20T00:55:27+00:00

URL: https://externals.io/message/1746#1748 · In reply to: #1747

<?PHP
  include_once( "foo.php" );
?>

Since foo.php doesn't exists, zend_open will fail and then try to send a 
warning message using file_handle.filename.  Since zend_open failed 
file_handle.filename will still be in its initial state of "file_handle = 
{0}".  zend_message_dispatcher is called with file_handle.filename, which 
calls php_message_handler_for_zend, which calls php_strip_url_passwd, which 
core dumps because *file_handle.filename is a bad address.

Brian


> 
>     Any example code?
>     
>     --Jani
>     
> 
> 
> 
> > […]
> 
> -- 
> <- For Sale!

---

## #1750 — Brian J. France — 2003-05-20T01:04:10+00:00

URL: https://externals.io/message/1746#1750 · In reply to: #1749

Did you get a warning that foo.php couldn't be included?  If not try to 
include_once a file that doesn't exists.  The patch is for PHP_4_3 and not cvs 
head.

Brian


> Your test script works fine for me.
> 
> -Sterling
> 
> 
> > […]
> -- 
> "The computer programmer is a creator of universes for which he  
>  alone is responsible. Universes of virtually unlimited complexity  
>  can be created in the form of computer programs." 
>     - Joseph Weizenbaum
