From: Felipe Pena Date: Sun, 7 Mar 2010 02:17:11 +0000 (+0000) Subject: - Fixed bug #50383 (Exceptions thrown in __call / __callStatic do not include file... X-Git-Tag: php-5.4.0alpha1~191^2~1893 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b674aa702a6b351565c4a5329599b2a432231f00;p=php - Fixed bug #50383 (Exceptions thrown in __call / __callStatic do not include file and line in trace) --- diff --git a/Zend/tests/bug50383.phpt b/Zend/tests/bug50383.phpt new file mode 100644 index 0000000000..2210c4bc35 --- /dev/null +++ b/Zend/tests/bug50383.phpt @@ -0,0 +1,130 @@ +--TEST-- +Bug #50383 (Exceptions thrown in __call / __callStatic do not include file and line in trace) +--FILE-- +foo(); +} + +try { + thrower(); +} catch(Exception $e) { + print $e->getMessage(); + print_r($e->getTrace()); +} + +try { + thrower2(); +} catch (Exception $e) { + print $e->getMessage(); + print_r($e->getTrace()); +} + +?> +--EXPECTF-- +Missing static method 'ThrowException' +Array +( + [0] => Array + ( + [file] => %s + [line] => 13 + [function] => __callStatic + [class] => myClass + [type] => :: + [args] => Array + ( + [0] => ThrowException + [1] => Array + ( + ) + + ) + + ) + + [1] => Array + ( + [file] => %s + [line] => 13 + [function] => ThrowException + [class] => myClass + [type] => :: + [args] => Array + ( + ) + + ) + + [2] => Array + ( + [file] => %s + [line] => 21 + [function] => thrower + [args] => Array + ( + ) + + ) + +) +Missing method 'foo' +Array +( + [0] => Array + ( + [file] => %s + [line] => 17 + [function] => __call + [class] => myClass + [type] => -> + [args] => Array + ( + [0] => foo + [1] => Array + ( + ) + + ) + + ) + + [1] => Array + ( + [file] => %s + [line] => 17 + [function] => foo + [class] => myClass + [type] => -> + [args] => Array + ( + ) + + ) + + [2] => Array + ( + [file] => %s + [line] => 28 + [function] => thrower2 + [args] => Array + ( + ) + + ) + +) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 2479cdcbb3..8d6a290c36 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -2236,7 +2236,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int while (prev) { if (prev->function_state.function && - prev->function_state.function->common.type != ZEND_USER_FUNCTION) { + prev->function_state.function->common.type != ZEND_USER_FUNCTION && + !(prev->function_state.function->common.type == ZEND_INTERNAL_FUNCTION && + (prev->function_state.function->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER))) { break; } if (prev->op_array) {