php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29890 set_error_handler race
Submitted: 2004-08-30 09:10 UTC Modified: 2005-05-18 20:12 UTC
From: maurice at alletha dot nl Assigned: tony2001 (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS, 4CVS (2004-12-12) OS: *
Private report: No CVE-ID: None
 [2004-08-30 09:10 UTC] maurice at alletha dot nl
Description:
------------
When creating a error function which has a parameter with an reference, php will create an endless loop in calling itself (i think). 
The proces keeps running and will not stop.
You can blog up a windows machine running under iis/cgi because it doesn't react on set_time_limit().
I've seen this problem in php 4.x and 5.x under windows and in linux on a dual system. Linux with a single cpu seemed not to have this problem (?)
(I'm using an additional parameter to my error function because of custom calling of the function)

Reproduce code:
---------------
<?

function customErrorHandler($fErrNo,$fErrStr,$fErrFile,$fErrLine,&$fClass) {

    echo "error :".$fErrStr;

}



set_time_limit(5);

error_reporting(E_ALL);

set_error_handler("customErrorHandler");



define("TEST",2);

//should return a notice that the constant is already defined

define("TEST",3);

?>



Expected result:
----------------
There should be a notice about the redefined "TEST" define

Actual result:
--------------
An endless loop.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-15 03:48 UTC] sniper@php.net
With recent CVS checkout I got it to crash with this backtrace (same with both 4 & 5):

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1087948032 (LWP 10686)]
0x082863cc in _zval_ptr_dtor (zval_ptr=0x861f890, 
    __zend_filename=0x84b3aa0 "/usr/src/web/php/php4/Zend/zend_execute.h", __zend_lineno=96)
    at /usr/src/web/php/php4/Zend/zend_execute_API.c:287
287             (*zval_ptr)->refcount--;
(gdb) bt
#0  0x082863cc in _zval_ptr_dtor (zval_ptr=0x861f890, 
    __zend_filename=0x84b3aa0 "/usr/src/web/php/php4/Zend/zend_execute.h", __zend_lineno=96)
    at /usr/src/web/php/php4/Zend/zend_execute_API.c:287
#1  0x082a7e8e in zend_ptr_stack_clear_multiple () at zend_execute.h:96
#2  0x082a4cc1 in execute (op_array=0x8624c4c)
    at /usr/src/web/php/php4/Zend/zend_execute.c:1721
#3  0x08290fb9 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /usr/src/web/php/php4/Zend/zend.c:900
#4  0x08258ac5 in php_execute_script (primary_file=0xbfffe110)
    at /usr/src/web/php/php4/main/main.c:1736
#5  0x082b69b5 in main (argc=2, argv=0xbfffe1a4)
    at /usr/src/web/php/php4/sapi/cli/php_cli.c:822
#6  0x42015704 in __libc_start_main () from /lib/tls/libc.so.6

 [2005-05-14 14:52 UTC] tony2001@php.net
Assigned to myself so I don't forget it..
 [2005-05-18 20:12 UTC] stas@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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 11:01:33 2024 UTC