]> granicus.if.org Git - php/commitdiff
- Fixed bug #50383 (Exceptions thrown in __call / __callStatic do not include file...
authorFelipe Pena <felipe@php.net>
Sun, 7 Mar 2010 02:17:11 +0000 (02:17 +0000)
committerFelipe Pena <felipe@php.net>
Sun, 7 Mar 2010 02:17:11 +0000 (02:17 +0000)
NEWS
Zend/tests/bug50383.phpt [new file with mode: 0644]
Zend/zend_builtin_functions.c

diff --git a/NEWS b/NEWS
index 4870d23416024b63e27afa052a622ce6eda3cd92..f43fe6d4338d1ef09ee02e017fea3ff941d9e438 100644 (file)
--- 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 (file)
index 0000000..844f764
--- /dev/null
@@ -0,0 +1,71 @@
+--TEST--
+Bug #50383 (Exceptions thrown in __call / __callStatic do not include file and line in trace)
+--FILE--
+<?php
+
+class myClass {
+       public function __call($method, $args) {
+               throw new Exception("Missing method '$method'\n");
+       }
+}
+
+function thrower2() {
+       $x = new myClass;
+       $x->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
+                (
+                )
+
+        )
+
+)
index 83045662b736040d2eee03e5a726bf9f7f04780b..c7481ae5830cc1101bb3729552ace7f26066eef2 100644 (file)
@@ -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) {