|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-18 07:19 UTC] sniper@php.net
[2004-08-10 15:08 UTC] skylark44 at mynet dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 21:00:01 2025 UTC |
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