ID:               50519
 Updated by:       j...@php.net
-Summary:          segfault when using set_error_handler and DomDocument
 Reported By:      robin dot kunde at gmail dot com
-Status:           Open
+Status:           Verified
 Bug Type:         Scripting Engine problem
-Operating System: linux
+Operating System: *
-PHP Version:      5.3.1
+PHP Version:      5.3, 6
 New Comment:

Happens with latest SVN, disabling GC makes the crash go away.
Backtrace:

Program received signal SIGSEGV, Segmentation fault.
zval_mark_grey (pz=0xa6cb578) at
/home/jani/src/php-5.3/Zend/zend_gc.c:360
360                             pz = *(zval**)p->pData;
(gdb) bt
#0  zval_mark_grey (pz=0xa6cb578) at
/home/jani/src/php-5.3/Zend/zend_gc.c:360
#1  0x082c5525 in gc_collect_cycles () at
/home/jani/src/php-5.3/Zend/zend_gc.c:417
#2  0x082aa9d5 in zend_deactivate () at
/home/jani/src/php-5.3/Zend/zend.c:900
#3  0x0825abcf in php_request_shutdown (dummy=0x0) at
/home/jani/src/php-5.3/main/main.c:1606
#4  0x08329604 in main (argc=3, argv=0xbff82544) at
/home/jani/src/php-5.3/sapi/cli/php_cli.c:1373



Previous Comments:
------------------------------------------------------------------------

[2009-12-18 17:32:38] robin dot kunde at gmail dot com

that snapshot (200912181530) seems to be identical to the one i used 
(200912181330). anyway, the problem persists.

------------------------------------------------------------------------

[2009-12-18 16:27:30] johan...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

sounds like #43918

------------------------------------------------------------------------

[2009-12-18 16:17:35] 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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50519&edit=1

Reply via email to