#48409 [Opn->Fbk]: Exception + nested functions + classes crash PHP 5.2
| From: | jani@php.net | Date: | Wed, 27 May 2009 19:22:06 +0000 |
| Subject: | #48409 [Opn->Fbk]: Exception + nested functions + classes crash PHP 5.2 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137797@lists.php.net to get a copy of this message | ||
ID: 48409
Updated by: jani@php.net
Reported By: nightstorm at tlen dot pl
-Status: Open
+Status: Feedback
Bug Type: Reproducible crash
Operating System: Linux 64bit gcc
PHP Version: 5.2CVS-2009-05-27 (snap)
New Comment:
Arnaud: I'd like to see the reportee's answers to my questions. And I
tested in 64bit system, gcc 4.1.2.
What was the GCC version you (both) used? :)
Previous Comments:
------------------------------------------------------------------------
[2009-05-27 18:42:08] lbarnaud@php.net
Looks like the same as bug #48228
Can reproduce on a 64bit system, not on 32bit.
"./configure --disable-all", default CFLAGS (-O2)
------------------------------------------------------------------------
[2009-05-27 18:28:29] jani@php.net
Note: I can not reproduce this.
------------------------------------------------------------------------
[2009-05-27 18:27:27] jani@php.net
Did you use --enable-debug or not? Change -O (optimizer level) compile
parameter?
------------------------------------------------------------------------
[2009-05-27 18:26:30] jani@php.net
<?php
class ABCException extends Exception {}
class BBB
{
public function xyz($d, $x)
{
if ($x == 34) {
throw new ABCException;
}
return array('foo' => 'xyz');
}
}
class CCC
{
public function process($p)
{
return $p;
}
}
class AAA
{
public function func()
{
$b = new BBB;
$c = new CCC;
$i = 34;
$item = array('foo' => 'bar');
try {
$c->process($b->xyz($item['foo'], $i));
}
catch(ABCException $e) {
$b->xyz($item['foo'], $i);
}
} // end func();
}
class Runner
{
public function run($x)
{
try {
$x->func();
}
catch(ABCException $e) {
throw new Exception;
}
}
}
try {
$runner = new Runner;
$runner->run(new AAA);
}
catch(Exception $e) {
die('Exception thrown');
}
?>
------------------------------------------------------------------------
[2009-05-27 17:02:45] nightstorm at tlen dot pl
Description:
------------
This an extended version of the code I've sent for bug #48408 that also
crashes both PHP 5.2.9 and the latest snapshot of PHP 5.2 (with
different debug backtrace).
The same script crashes also the latest PHP 5.3-dev snapshot but
generates a different backtrace. The information about the environment:
- The script was run from PHP Command-Line Interface
- No extra patches or modifications were used (pure snapshot)
- No debugging symbols were used.
- Operating system: Arch Linux x86_64.
The problem may be related to http://bugs.php.net/bug.php?id=48408 as
the reproduce code is similar.
Reproduce code:
---------------
See:
http://media.zyxist.com/snippets/exception_segfault1.phps
Expected result:
----------------
"Exception thrown"
Actual result:
--------------
Core was generated by `/usr/local/php/bin/php
exception_segfault1.php'.
Program terminated with signal 11, Segmentation fault.
[New process 12255]
#0 zend_do_fcall_common_helper_SPEC (execute_data=0x7fff56fcab90) at
/usr/src/php-5.2-dev/Zend/zend_vm_execute.h:289
289 if (RETURN_VALUE_USED(ctor_opline)) {
(gdb) backtrace
#0 zend_do_fcall_common_helper_SPEC (execute_data=0x7fff56fcab90) at
/usr/src/php-5.2-dev/Zend/zend_vm_execute.h:289
#1 0x0000000000704cd4 in execute (op_array=0x7feb4ee45b90) at
/usr/src/php-5.2-dev/Zend/zend_vm_execute.h:92
#2 0x00000000006e2741 in zend_execute_scripts (type=8, retval=0x51,
file_count=3) at /usr/src/php-5.2-dev/Zend/zend.c:1134
#3 0x00000000006a020f in php_execute_script
(primary_file=0x7fff56fcd200) at /usr/src/php-5.2-dev/main/main.c:2025
#4 0x0000000000754afe in main (argc=2, argv=0x7fff56fcd3e8) at
/usr/src/php-5.2-dev/sapi/cli/php_cli.c:1162
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48409&edit=1