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.2.14RC1~106 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7043a8aace507847fe6aa7369f8320c6d437a853;p=php - Fixed bug #50383 (Exceptions thrown in __call / __callStatic do not include file and line in trace) --- diff --git a/NEWS b/NEWS index 4870d23416..f43fe6d433 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,8 @@ PHP NEWS - Fixed bug #51062 (DBA DB4 uses mismatched headers and libraries). (Chris Jones) - Fixed bug #51023 (filter doesn't detect int overflows with GCC 4.4). (Raphael Geissert) +- Fixed bug #50383 (Exceptions thrown in __call / __callStatic do not include + file and line in trace). (Felipe) - Fixed bug #49267 (Linking fails for iconv). (Moriyosh) - Fixed bug #43314 (iconv_mime_encode(), broken Q scheme). (Rasmus) - Fixed bug #23229 (syslog function truncates messages). (Adam) diff --git a/Zend/tests/bug50383.phpt b/Zend/tests/bug50383.phpt new file mode 100644 index 0000000000..844f7642c1 --- /dev/null +++ b/Zend/tests/bug50383.phpt @@ -0,0 +1,71 @@ +--TEST-- +Bug #50383 (Exceptions thrown in __call / __callStatic do not include file and line in trace) +--FILE-- +foo(); +} + +try { + thrower2(); +} catch (Exception $e) { + print $e->getMessage(); + print_r($e->getTrace()); +} + +?> +--EXPECTF-- +Missing method 'foo' +Array +( + [0] => Array + ( + [file] => %s + [line] => 11 + [function] => __call + [class] => myClass + [type] => -> + [args] => Array + ( + [0] => foo + [1] => Array + ( + ) + + ) + + ) + + [1] => Array + ( + [file] => %s + [line] => 11 + [function] => foo + [class] => myClass + [type] => -> + [args] => Array + ( + ) + + ) + + [2] => Array + ( + [file] => %s + [line] => 15 + [function] => thrower2 + [args] => Array + ( + ) + + ) + +) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 83045662b7..c7481ae583 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1987,7 +1987,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) {