From:             auslander at tampabay dot rr dot com
Operating system: Linux 2.6.5
PHP version:      5.0.0RC3
PHP Bug Type:     Reproducible crash
Bug description:  throw exception causes segfault

Description:
------------
throwing an exception causes a segfault.

test case 1:
created an object (A) within another object (B).  B calls
$this->A->close() then sets $this->A = null which calls
$this->A->__destruct() method which calls A->close() again.  on the second
call of A->close(), an exception is thrown which results in a segfault.

test case 2:
when creating A directly, without going through another object, no
segfault happens, but still, no exception is thrown and no error.


Reproduce code:
---------------
http://gub.no-ip.org:8546/~auslander/bugtest.php.txt


Expected result:
----------------
expect no segfault and expect exception to be thrown/caught in both test
cases.

Actual result:
--------------
test case 1 output/backtrace
---------------------------------
test 1
------
creating Bar object
Bar::__construct() called
Foo::__construct() called
closing Bar
Bar::close() called
Foo::close() called
Foo::__destruct() called
Foo::close() called
supposed to throw an exception here
Segmentation fault

#0  0x00000000 in ?? ()
#1  0x082039e3 in execute (op_array=0xf709f444)
    at /usr/local/src/php-5.0.0RC3/Zend/zend_execute.c:1389
#2  0x08206a75 in zend_do_fcall_common_helper (execute_data=0xfeeb09d0,
    opline=0xf70a1340, op_array=0xf7096304)
    at /usr/local/src/php-5.0.0RC3/Zend/zend_execute.c:2726
#3  0x08206d4c in zend_do_fcall_by_name_handler (execute_data=0xf70a08c8,
    opline=0xf70a1340, op_array=0xf7096304)
    at /usr/local/src/php-5.0.0RC3/Zend/zend_execute.c:2808
#4  0x082039e3 in execute (op_array=0xf7096304)
    at /usr/local/src/php-5.0.0RC3/Zend/zend_execute.c:1389
#5  0x081e9285 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /usr/local/src/php-5.0.0RC3/Zend/zend.c:1061
#6  0x081b753e in php_execute_script (primary_file=0xfeeb2db0)
    at /usr/local/src/php-5.0.0RC3/main/main.c:1627
#7  0x0820e112 in main (argc=3, argv=0xfeeb2e74)
    at /usr/local/src/php-5.0.0RC3/sapi/cli/php_cli.c:943

test case 2 output (no segfault/backtrace)
---------------------------------
test 2
------
creating Foo object
Foo::__construct() called
closing Foo
Foo::close() called
setting Foo to null
Foo::__destruct() called
Foo::close() called
supposed to throw an exception here


-- 
Edit bug report at http://bugs.php.net/?id=29054&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29054&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29054&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29054&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29054&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29054&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29054&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29054&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29054&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29054&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29054&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29054&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29054&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29054&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29054&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29054&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29054&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29054&r=float

Reply via email to