From: robin dot kunde at gmail dot com
Operating system: linux
PHP version: 5.3.1
PHP Bug Type: Scripting Engine problem
Bug description: segfault when using set_error_handler and DomDocument
Description:
------------
After setting a custom class based error handler, then using DomDocument,
then setting the same error handler again, without resetting it first, PHP
segfaults during shutdown. A function based error handler doesn't cause the
problem. Executed the three commands in any other order doesn't cause the
problem.
tested with:
php-5.3.1
php5.3-200912181330 (./configure --enable-debug)
libxml2 (2.7.5)
Reproduce code:
---------------
<?php
set_error_handler(array('ErrorHandler', 'handlePhpError'));
new DomDocument();
set_error_handler(array('ErrorHandler', 'handlePhpError'));
class ErrorHandler
{
static function handlePhpError($errno, $errstr, $errfile, $errline)
{
return true;
}
}
>?
Expected result:
----------------
nothing
Actual result:
--------------
segmentation fault
backtrace:
Program received signal SIGSEGV, Segmentation fault.
zval_mark_grey (pz=0x86fafec) at
/home/xxx/src/php5.3-200912181330/Zend/zend_gc.c:360
360 pz = *(zval**)p->pData;
(gdb) bt
#0 zval_mark_grey (pz=0x86fafec) at
/home/xxx/src/php5.3-200912181330/Zend/zend_gc.c:360
#1 0x082f3aed in gc_mark_roots () at
/home/xxx/src/php5.3-200912181330/Zend/zend_gc.c:417
#2 gc_collect_cycles () at
/home/xxx/src/php5.3-200912181330/Zend/zend_gc.c:628
#3 0x082d85f5 in zend_deactivate () at
/home/xxx/src/php5.3-200912181330/Zend/zend.c:900
#4 0x08287953 in php_request_shutdown (dummy=0x0) at
/home/xxx/src/php5.3-200912181330/main/main.c:1606
#5 0x08357956 in main (argc=2, argv=0xbffff4c4) at
/home/xxx/src/php5.3-200912181330/sapi/cli/php_cli.c:1373
--
Edit bug report at http://bugs.php.net/?id=50519&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50519&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50519&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50519&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50519&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50519&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50519&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50519&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50519&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50519&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50519&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50519&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50519&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50519&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50519&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50519&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50519&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50519&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50519&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50519&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50519&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50519&r=mysqlcfg