From: nightstorm at tlen dot pl
Operating system: Arch Linux 64-bit
PHP version: 5.3CVS-2009-05-27 (snap)
PHP Bug Type: Reproducible crash
Bug description: Exception thrown from two functions nested in expression
causes segfault
Description:
------------
The code provided below causes segfault on today's PHP 5.3 snapshot. The
same script works correctly on PHP 5.2.9. I noticed that if you comment or
change the line with "#1#" comment, the segmentation fault does not occur.
Reproduce code:
---------------
<?php
class B{
public function process($x){
return $x;
}
}
class C{
public function generate($x){
throw new Exception;
}
}
$b = new B;
$c = new C;
try{
$b->process($c->generate(0));
}
catch(Exception $e){
$c->generate(0);// #1#
}
Expected result:
----------------
The script completes its work.
Actual result:
--------------
Segmentation fault:
Program terminated with signal 11, Segmentation fault.
[New process 17244]
#0 ZEND_HANDLE_EXCEPTION_SPEC_HANDLER (execute_data=0x7f0dbdf18050) at
/usr/src/php-5.3-dev/Zend/zend.h:392
392 return --pz->refcount__gc;
(gdb) backtrace 5
#0 ZEND_HANDLE_EXCEPTION_SPEC_HANDLER (execute_data=0x7f0dbdf18050) at
/usr/src/php-5.3-dev/Zend/zend.h:392
#1 0x0000000000741819 in execute (op_array=0x7f0dc11eacd0) at
/usr/src/php-5.3-dev/Zend/zend_vm_execute.h:104
#2 0x0000000000717bf5 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/src/php-5.3-dev/Zend/zend.c:1188
#3 0x00000000006c5099 in php_execute_script (primary_file=0x7fffc936f510)
at /usr/src/php-5.3-dev/main/main.c:2182
#4 0x00000000007a000e in main (argc=2, argv=0x7fffc936f778) at
/usr/src/php-5.3-dev/sapi/cli/php_cli.c:1188
--
Edit bug report at http://bugs.php.net/?id=48408&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48408&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48408&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48408&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48408&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48408&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48408&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48408&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48408&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48408&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48408&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48408&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48408&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48408&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48408&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48408&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48408&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48408&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48408&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48408&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48408&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48408&r=mysqlcfg