PHP :: Bug #41608 :: user error handler crashes

Bug #41608 user error handler crashes
Submitted: 2007-06-06 07:44 UTC Modified: 2009-09-27 14:27 UTC
Votes:6
Avg. Score:4.5 ± 0.8
Reproduced:6 of 6 (100.0%)
Same Version:4 (66.7%)
Same OS:4 (66.7%)
From: aigors at inbox dot lv Assigned: dmitry (profile)
Status: Wont fix Package: Reproducible crash
PHP Version: 5.2.10 OS: Windows XP
Private report: No CVE-ID: None

 [2007-06-06 07:44 UTC] aigors at inbox dot lv

Description:
------------
Apache crash because of script containing set_error_handler function.

Reproduce code:
---------------
/***Main php file***/
<?php
function MyErrorHandler($errno, $errstr, $errfile, $errline){
  include_once('empty.php');
}
set_error_handler("MyErrorHandler");
include_once('blah.php');
echo('I am done');
?>

/***blah.php file***/
<?php
class Blah {
  function foo($value, $classname) {
    switch(strtolower($value['key'])) {
      default: $x = &new $classname;
    }
  }
}
?>

/***empty.php file - no content***/

Expected result:
----------------
Should output "I am done"

Actual result:
--------------
Apache crash

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2007-06-06 08:35 UTC] tony2001@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2007-12-18 09:47 UTC] aigors at inbox dot lv

Bug still exists in PHP 5.2.5.

 [2008-01-15 07:29 UTC] aigors at inbox dot lv

Yes, it appears that bug is in the snapshots also.

 [2008-01-26 01:07 UTC] jani@php.net

Antony..you claimed to have fixed this? :)

 [2008-02-09 01:14 UTC] stas@php.net

Breaks for me in 5.3CVS head too.

 [2008-08-13 20:09 UTC] jani@php.net

Does not crash (in Linux, non ZTS) with latest snapshots of PHP_5_2 and PHP_5_3 branches.

 [2009-06-15 09:18 UTC] aigors at inbox dot lv

Fails for me with PHP Version 5.2.10RC2 with the same test case.

 [2009-06-15 09:26 UTC] aigors at inbox dot lv

Also fails with the latest snapshot 5.2.10RC3-dev with build date Jun 14 2009 23:39:25.

 [2009-06-29 10:57 UTC] tony2001@php.net

Not reproducible with latest 5.2, but I do see some problems in 5.3 under Valgrind.
Dmitry, please check this out.

 [2009-06-29 13:54 UTC] dmitry@php.net

The crash occurs because the compiler is not reinterant and this test case makes recursive compiler call. Of course it's not a good idea to call include from error handler.

I think it's not possible to make compiler reinterant in 5.2 (because if binary compatibility), we can just disable recursive calls and emit coresponding error message. It's not a perfect decision as well, as it may break some code which worked before.

Even for 5.3 it's not a simple fix but a big feature that may delay GA release.

 [2009-07-23 11:47 UTC] svoboda at svoon dot net

Hi all,
does it mean that is already fixed in CVS version (5.2x and 5.3x) branches?

thank you
Ondrej

 [2009-09-25 23:25 UTC] aigors at inbox dot lv

Still crashes with 5.2.11 on Windows XP OS.

After the dmitry comment I've understood that this issue is going to the "wontfix" status.