|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-12-18 16:17 UTC] robin dot kunde at gmail dot com
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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 14:00:01 2025 UTC |
Hi ... we currently reproduced the segfault in the same line (zend_gc.c - "pz = *(zval**)p->pData;": - PHP 5.4.7 - Very long running and memory intensive command line script - Always reproducable GDB-Backtrace: Program terminated with signal 11, Segmentation fault. #0 0x00000000006e7576 in zval_mark_grey (pz=0x2c36d00) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_gc.c:425 425 pz = *(zval**)p->pData; (gdb) bt #0 0x00000000006e7576 in zval_mark_grey (pz=0x2c36d00) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_gc.c:425 #1 0x00000000006e84ce in gc_collect_cycles () at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_gc.c:471 #2 0x00000000006e8864 in gc_zval_possible_root (zv=0x2c36d00) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_gc.c:166 #3 0x00000000006d5dbb in zend_hash_destroy (ht=0x1811dcb8) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_hash.c:560 #4 0x00000000006c8179 in _zval_dtor_func (zvalue=0x189270f0) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_variables.c:43 #5 0x00000000006bb29d in _zval_ptr_dtor (zval_ptr=0x2ac8cc0) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_variables.h:35 #6 0x00000000006d7f28 in _zend_hash_add_or_update (ht=0x7f27eb1873b0, arKey=0x18cb3870 "instruments", nKeyLength=12, pData=0x1, nDataSize=415173616, pDest=0x0, flag=6061480) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_hash.c:234 #7 0x00000000005c7da8 in T.292 (ht=0x2c36d00, arKey=0x7fff0da8a360 "\370\025\016\353'\177", nKeyLength=2, pData=0x7f27eb1a1200) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_hash.h:351 #8 0x00000000005ccd66 in spl_array_write_dimension_ex (check_inherited=415524600, object=0x18c466f8, offset=0x18bf5238, value=0x6a624f7961727241) at /usr/src/php5.4/source/php5-5.4.7/ext/spl/spl_array.c:461 #9 0x00000000005cd3b6 in zim_spl_Array_offsetSet (ht=46361856, return_value=0x7fff0da8a360, return_value_ptr=0x2, this_ptr=0x7f27eb1874f0, return_value_used=415173616) at /usr/src/php5.4/source/php5-5.4.7/ext/spl/spl_array.c:713 #10 0x00007f280964206b in xdebug_execute_internal () from /usr/lib/php5/20100525/xdebug.so #11 0x0000000000745806 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f280da03108) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_vm_execute.h:644 #12 0x0000000000732978 in execute (op_array=0x7f27eb19e648) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_vm_execute.h:410 #13 0x00007f2809642509 in xdebug_execute () from /usr/lib/php5/20100525/xdebug.so #14 0x0000000000745b03 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f280da01e40) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_vm_execute.h:669 #15 0x0000000000732978 in execute (op_array=0x33d0240) at /usr/src/php5.4/source/php5-5.4.7/Zend/zend_vm_execute.h:410 ...