From: dan at wep dot net Operating system: Fedora Core 3 PHP version: 5.0.4 PHP Bug Type: Reproducible crash Bug description: Calling assert() against local class var in __destruct() causes segfault
Description: ------------ Attempts to access local class variables (defined or not) in a destructor via an assertion causes a segfault. Reproduce code: --------------- <?php class test { private $localValue = 'a string'; function __destruct() { print($this->localValue); // Works OK assert('isset($this->localValue)'); // Segfaults assert('isset($this->unknownValue)'); // Segfaults } } $inst = new test(); ?> Expected result: ---------------- PHP Warning: assert(): Assertion "isset($this->unknownValue)" failed in test.php on line 7 Actual result: -------------- Segmentation fault (gdb) bt #0 0x081896bb in yy_push_state (new_state=6) at Zend/zend_language_scanner.c:5990 #1 0x08185b0f in lex_scan (zendlval=0xbfffe874) at Zend/zend_language_scanner.c:4021 #2 0x08194e68 in zendlex (zendlval=0xbfffe870) at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_compile.c:3688 #3 0x08180ab5 in zendparse () at Zend/zend_language_parser.c:2221 #4 0x0818501b in compile_string (source_string=0xbfffe8c0, filename=0x8361b6c "/home/dcox/test.php(6) : assert code") at Zend/zend_language_scanner.c:3293 #5 0x0819866f in zend_eval_string (str=0x8362ebc "isset($this->localValue)", retval_ptr=0xbfffe9b0, string_name=0x8361b6c "/home/dcox/test.php(6) : assert code") at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_execute_API.c:994 #6 0x08136410 in zif_assert (ht=1, return_value=0x835014c, this_ptr=0x0, return_value_used=0) at /usr/src/redhat/BUILD/php-5.0.4/ext/standard/assert.c:152 #7 0x081cbb0e in zend_do_fcall_common_helper (execute_data=0xbfffeac0, opline=0x83619bc, op_array=0x8362c1c) at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_execute.c:2727 #8 0x081cc2f9 in zend_do_fcall_handler (execute_data=0xbfffeac0, opline=0x83619bc, op_array=0x8362c1c) at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_execute.c:2859 #9 0x081c6cce in execute (op_array=0x8362c1c) at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_execute.c:1406 #10 0x0819808a in zend_call_function (fci=0xbfffec80, fci_cache=0xbfffec40) at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_execute_API.c:852 #11 0x081b2ba0 in zend_call_method (object_pp=0xbfffed2c, obj_ce=0x8361304, fn_proxy=0x0, function_name=0x820d6db "__destruct", function_name_len=10, retval_ptr_ptr=0x0, param_count=0, arg1=0x0, arg2=0x0) at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_interfaces.c:86 #12 0x081b73fe in zend_objects_destroy_object (object=0x8350064, handle=1) at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_objects.c:78 #13 0x081b9982 in zend_objects_store_call_destructors (objects=0x82290a4) at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_objects_API.c:54 #14 0x08196167 in shutdown_executor () at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend_execute_API.c:207 #15 0x081a2715 in zend_deactivate () at /usr/src/redhat/BUILD/php-5.0.4/Zend/zend.c:817 #16 0x081636e1 in php_request_shutdown (dummy=0x0) at /usr/src/redhat/BUILD/php-5.0.4/main/main.c:1216 #17 0x081d1fe5 in main (argc=3, argv=0xbffffa74) at /usr/src/redhat/BUILD/php-5.0.4/sapi/cli/php_cli.c:1049 (gdb) -- Edit bug report at http://bugs.php.net/?id=33165&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33165&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33165&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33165&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33165&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33165&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33165&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33165&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33165&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33165&r=support Expected behavior: http://bugs.php.net/fix.php?id=33165&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33165&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33165&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33165&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33165&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33165&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33165&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33165&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33165&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33165&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33165&r=mysqlcfg