From: guth at fiifo dot u-psud dot fr
Operating system: Linux (mandrake 10)
PHP version: 5.0.1
PHP Bug Type: Zend Engine 2 problem
Bug description: Segmentation fault with not catched exception
Description:
------------
[ bad english, i know ]
It seems that PHP 5 is not very stable.
My code segfaults every 3-4 days :'(
Reproduce code:
---------------
<?php
class B {
}
class A {
public $b;
public function __construct() {
$this->b = new B;
}
public function build() {
return $this->b;
}
}
class C {
private $b;
public function __construct() {
$a = new A();
$this->b = $a->build();
try {
throw new Exception;
} catch(Exception $e) {
}
}
public function __destruct() {
throw new Exception;
}
}
$C = new C;
?>
Expected result:
----------------
Something like "An uncaught exception has been thrown..."
Note that the code works as expected if you remove the following lines :
"$a = new A();
$this->b = $a->build();"
Actual result:
--------------
segmentation fault :)
(gdb) bt
#0 0x08205ec8 in zend_objects_destroy_object (object=0x831ae6c, handle=3)
at /usr/src/php-5.0.1/Zend/zend_objects.c:37
#1 0x082089ec in zend_objects_store_del_ref (zobject=0x831ae2c) at
/usr/src/php-5.0.1/Zend/zend_objects_API.c:144
#2 0x081efe22 in _zval_dtor (zvalue=0x831ae2c, __zend_filename=0x82641e0
"/usr/src/php-5.0.1/Zend/zend_execute_API.c",
__zend_lineno=391) at /usr/src/php-5.0.1/Zend/zend_variables.c:61
#3 0x081e465c in _zval_ptr_dtor (zval_ptr=0x8307848,
__zend_filename=0x8265100 "/usr/src/php-5.0.1/Zend/zend_variables.c",
__zend_lineno=193)
at /usr/src/php-5.0.1/Zend/zend_execute_API.c:391
#4 0x081f0174 in _zval_ptr_dtor_wrapper (zval_ptr=0x8307848) at
/usr/src/php-5.0.1/Zend/zend_variables.c:193
#5 0x081f96c4 in zend_hash_destroy (ht=0x8313e7c) at
/usr/src/php-5.0.1/Zend/zend_hash.c:519
#6 0x0820612e in zend_objects_free_object_storage (object=0x831ac04) at
/usr/src/php-5.0.1/Zend/zend_objects.c:88
#7 0x08208749 in zend_objects_store_free_object_storage
(objects=0x8288664)
at /usr/src/php-5.0.1/Zend/zend_objects_API.c:72
#8 0x081e418b in shutdown_executor () at
/usr/src/php-5.0.1/Zend/zend_execute_API.c:272
#9 0x081f17c3 in zend_deactivate () at
/usr/src/php-5.0.1/Zend/zend.c:819
#10 0x081aa454 in php_request_shutdown (dummy=0x0) at
/usr/src/php-5.0.1/main/main.c:1212
#11 0x082232b8 in main (argc=2, argv=0xbffff624) at
/usr/src/php-5.0.1/sapi/cli/php_cli.c:1046
--
Edit bug report at http://bugs.php.net/?id=30163&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30163&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30163&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30163&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30163&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30163&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30163&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30163&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30163&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30163&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30163&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30163&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30163&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30163&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30163&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30163&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30163&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30163&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30163&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30163&r=mysqlcfg