felipe Sun, 07 Mar 2010 02:17:11 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=295913
Log:
- Fixed bug #50383 (Exceptions thrown in __call / __callStatic do not include
file and line in trace)
Bug: http://bugs.php.net/50383 (Verified) Exceptions thrown in __call /
__callStatic do not include file and line in trace
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
A php/php-src/branches/PHP_5_2/Zend/tests/bug50383.phpt
U php/php-src/branches/PHP_5_2/Zend/zend_builtin_functions.c
U php/php-src/branches/PHP_5_3/NEWS
A php/php-src/branches/PHP_5_3/Zend/tests/bug50383.phpt
U php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c
A php/php-src/trunk/Zend/tests/bug50383.phpt
U php/php-src/trunk/Zend/zend_builtin_functions.c
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2010-03-07 00:57:19 UTC (rev 295912)
+++ php/php-src/branches/PHP_5_2/NEWS 2010-03-07 02:17:11 UTC (rev 295913)
@@ -13,6 +13,8 @@
- 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)
Added: php/php-src/branches/PHP_5_2/Zend/tests/bug50383.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/tests/bug50383.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/Zend/tests/bug50383.phpt 2010-03-07 02:17:11 UTC (rev 295913)
@@ -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
+ (
+ )
+
+ )
+
+)
Property changes on: php/php-src/branches/PHP_5_2/Zend/tests/bug50383.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/branches/PHP_5_2/Zend/zend_builtin_functions.c
===================================================================
--- php/php-src/branches/PHP_5_2/Zend/zend_builtin_functions.c 2010-03-07 00:57:19 UTC (rev 295912)
+++ php/php-src/branches/PHP_5_2/Zend/zend_builtin_functions.c 2010-03-07 02:17:11 UTC (rev 295913)
@@ -1987,7 +1987,9 @@
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) {
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2010-03-07 00:57:19 UTC (rev 295912)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-03-07 02:17:11 UTC (rev 295913)
@@ -22,6 +22,8 @@
- Fixed bug #50810 (property_exists does not work for private). (Felipe)
- Fixed bug #50731 (Inconsistent namespaces sent to functions registered with
spl_autoload_register). (Felipe)
+- Fixed bug #50383 (Exceptions thrown in __call / __callStatic do not include
+ file and line in trace). (Felipe)
- Fixed bug #50358 (Compile failure compiling ext/phar/util.lo). (Felipe)
?? ??? 20??, PHP 5.3.2
Added: php/php-src/branches/PHP_5_3/Zend/tests/bug50383.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug50383.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug50383.phpt 2010-03-07 02:17:11 UTC (rev 295913)
@@ -0,0 +1,130 @@
+--TEST--
+Bug #50383 (Exceptions thrown in __call / __callStatic do not include file and line in trace)
+--FILE--
+<?php
+
+class myClass {
+ public static function __callStatic($method, $args) {
+ throw new Exception("Missing static method '$method'\n");
+ }
+ public function __call($method, $args) {
+ throw new Exception("Missing method '$method'\n");
+ }
+}
+
+function thrower() {
+ myClass::ThrowException();
+}
+function thrower2() {
+ $x = new myClass;
+ $x->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
+ (
+ )
+
+ )
+
+)
Property changes on: php/php-src/branches/PHP_5_3/Zend/tests/bug50383.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c 2010-03-07 00:57:19 UTC (rev 295912)
+++ php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c 2010-03-07 02:17:11 UTC (rev 295913)
@@ -2148,7 +2148,9 @@
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) {
Added: php/php-src/trunk/Zend/tests/bug50383.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug50383.phpt (rev 0)
+++ php/php-src/trunk/Zend/tests/bug50383.phpt 2010-03-07 02:17:11 UTC (rev 295913)
@@ -0,0 +1,130 @@
+--TEST--
+Bug #50383 (Exceptions thrown in __call / __callStatic do not include file and line in trace)
+--FILE--
+<?php
+
+class myClass {
+ public static function __callStatic($method, $args) {
+ throw new Exception("Missing static method '$method'\n");
+ }
+ public function __call($method, $args) {
+ throw new Exception("Missing method '$method'\n");
+ }
+}
+
+function thrower() {
+ myClass::ThrowException();
+}
+function thrower2() {
+ $x = new myClass;
+ $x->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
+ (
+ )
+
+ )
+
+)
Property changes on: php/php-src/trunk/Zend/tests/bug50383.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/trunk/Zend/zend_builtin_functions.c
===================================================================
--- php/php-src/trunk/Zend/zend_builtin_functions.c 2010-03-07 00:57:19 UTC (rev 295912)
+++ php/php-src/trunk/Zend/zend_builtin_functions.c 2010-03-07 02:17:11 UTC (rev 295913)
@@ -2236,7 +2236,9 @@
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) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php