ID: 24573 Comment by: lanza at sfu dot ca Reported By: brad at info-link dot net Status: Closed Bug Type: Scripting Engine problem Operating System: Linux 2.4.21 PHP Version: 4.3.3RC1 New Comment:
===================================================================== FAILED TEST SUMMARY --------------------------------------------------------------------- Bug #24573 (debug_backtrace() crashes if $this is set to null) [tests/lang/bug24573.phpt] Testing randomization of shuffle() and str_shuffle(). [ext/standard/tests/strings/004.phpt] ===================================================================== SunOS 5.8 Generic_108528-14 sun4u PHP Version => 4.3.3RC3-dev (GNU automake) 1.7.5 (GNU Autoconf) 2.57 (GNU libtool) 1.4.3 (GNU Bison) 1.875 How can I fix this? Please!!! Previous Comments: ------------------------------------------------------------------------ [2003-07-18 07:19:23] [EMAIL PROTECTED] This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2003-07-09 22:23:30] brad at info-link dot net Description: ------------ debug_backtrace crashes PHP if called from a class method after $this is set to null. Reproduce code: --------------- The following script illustrates the problem: <?php class Foo { function Bar() { $__this = $this; // unset($this); $this = null; print_r(debug_backtrace()); $this = $__this; } } $f = new Foo; $f->Bar(); ?> Strangely, if you use unset instead of assigning $this to null, the crash does not occur. Actual result: -------------- Program received signal SIGSEGV, Segmentation fault. 0x4025ded4 in zif_debug_backtrace (ht=0, return_value=0x81a260c, this_ptr=0x0, return_value_used=1) at /usr/local/php/src/php4-STABLE-200307100130/Zend/zend_builtin_functions.c:1246 1246 class_name = ptr->object.ptr->value.obj.ce->name; (gdb) bt #0 0x4025ded4 in zif_debug_backtrace (ht=0, return_value=0x81a260c, this_ptr=0x0, return_value_used=1) at /usr/local/php/src/php4-STABLE-200307100130/Zend/zend_builtin_functions.c:1246 #1 0x40267f38 in execute (op_array=0x81a21fc) at /usr/local/php/src/php4-STABLE-200307100130/Zend/zend_execute.c:1616 #2 0x402680f6 in execute (op_array=0x819d434) at /usr/local/php/src/php4-STABLE-200307100130/Zend/zend_execute.c:1660 #3 0x40255940 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/php/src/php4-STABLE-200307100130/Zend/zend.c:886 #4 0x4022e83c in php_execute_script (primary_file=0xbffff6e0) at /usr/local/php/src/php4-STABLE-200307100130/main/main.c:1685 #5 0x4026f34a in apache_php_module_main (r=0x81d9774, display_source_mode=0) at /usr/local/php/src/php4-STABLE-200307100130/sapi/apache/sapi_apache.c:54 #6 0x4026ff32 in send_php (r=0x81d9774, display_source_mode=0, filename=0x0) at /usr/local/php/src/php4-STABLE-200307100130/sapi/apache/mod_php4.c:620 #7 0x4026ff86 in send_parsed_php (r=0x81d9774) at /usr/local/php/src/php4-STABLE-200307100130/sapi/apache/mod_php4.c:635 #8 0x0808dd77 in ap_invoke_handler () #9 0x080a2e57 in process_request_internal () #10 0x080a2eb8 in ap_process_request () #11 0x08099cc9 in child_main () #12 0x08099e74 in make_child () #13 0x08099fe8 in startup_children () #14 0x0809a660 in standalone_main () #15 0x0809aec3 in main () #16 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24573&edit=1