ID:               28213
 Comment by:       wf at bitplan dot com
 Reported By:      [EMAIL PROTECTED]
 Status:           Assigned
 Bug Type:         Zend Engine 2 problem
 Operating System: Linux
 PHP Version:      5CVS-2004-04-29 (dev)
 Assigned To:      Andi
 New Comment:

Spurious crashes happen also if used like this:
function internal_error($msg) {
        global $testmode_errordisplay;
        if (isset($testmode_errordisplay)) {
                display_error($msg,"ERROR");
                if ($testmode_errordisplay=="stacktrace")
                        printStackTrace();
        }       
        user_error($msg);
}


Previous Comments:
------------------------------------------------------------------------

[2004-04-29 05:38:46] [EMAIL PROTECTED]

Description:
------------
debug_print_backtrace() will crash PHP when called from inside a static
function used as custom error handler function.

Reproduce code:
---------------
<?php
class FooBar { static function error() { debug_print_backtrace(); } }
set_error_handler(array('FooBar', 'error'));
include('foobar.php');
?>

Actual result:
--------------
magnus:crash > php crash.php
#0  FooBar::error() called at
[/home/magnus/Projects/base/tests/crash/crash.php:6]
#1  FooBarSegmentation fault

(gdb) bt
#0  0x40d4cb53 in strlen () from /lib/libc.so.6
#1  0x0839a0a9 in zif_debug_print_backtrace (ht=0,
return_value=0x40e24720, this_ptr=0x0, return_value_used=0)
    at /mnt/data1/Apps/CVS/PHP/php5/Zend/zend_builtin_functions.c:1549
#2  0x083b53a8 in zend_do_fcall_common_helper (execute_data=0xbfffc9d0,
opline=0x40e25584, op_array=0x40e2691c)
    at /mnt/data1/Apps/CVS/PHP/php5/Zend/zend_execute.c:2699
#3  0x083b5bbb in zend_do_fcall_handler (execute_data=0xbfffc9d0,
opline=0x40e25584, op_array=0x40e2691c)
    at /mnt/data1/Apps/CVS/PHP/php5/Zend/zend_execute.c:2828


#1  0x0839a0a9 in zif_debug_print_backtrace (ht=0,
return_value=0x40e24720, this_ptr=0x0, return_value_used=0)
    at /mnt/data1/Apps/CVS/PHP/php5/Zend/zend_builtin_functions.c:1549
        ptr = (zend_execute_data *) 0xbfffd060
        lineno = 4
        function_name = 0x848cf97 "include"
        filename = 0x40e23c08
"/home/magnus/Projects/base/tests/crash/crash.php"
        class_name = 0x40e25070 "FooBar"
        call_type = 0x0
        include_filename = 0x40e23c08
"/home/magnus/Projects/base/tests/crash/crash.php"
        arg_array = (zval *) 0x40e2481c
        cur_arg_pos = (void **) 0x40e13c90
        args = (void **) 0x40e13c74
        arg_stack_consistent = 1
        frames_on_stack = 1
        indent = 1
#2  0x083b53a8 in zend_do_fcall_common_helper (execute_data=0xbfffc9d0,
opline=0x40e25584, op_array=0x40e2691c)
    at /mnt/data1/Apps/CVS/PHP/php5/Zend/zend_execute.c:2699
        original_return_value = (zval **) 0x3f7
        current_scope = (zend_class_entry *) 0x853e4d8
        current_this = (zval *) 0x0
        return_value_used = 0
        should_change_scope = 0 '\0'
#3  0x083b5bbb in zend_do_fcall_handler (execute_data=0xbfffc9d0,
opline=0x40e25584, op_array=0x40e2691c)
    at /mnt/data1/Apps/CVS/PHP/php5/Zend/zend_execute.c:2828
        fname = (zval *) 0x40e255a0


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28213&edit=1

Reply via email to