]> granicus.if.org Git - php/commitdiff
Show argument causing TypeException in trace
authorNikita Popov <nikic@php.net>
Sun, 17 May 2015 19:49:53 +0000 (21:49 +0200)
committerNikita Popov <nikic@php.net>
Wed, 20 May 2015 16:28:09 +0000 (18:28 +0200)
Not sure why that check was there, did I miss something?

22 files changed:
Zend/tests/array_type_hint_001.phpt
Zend/tests/bug39003.phpt
Zend/tests/bug42802.phpt
Zend/tests/bug43332_1.phpt
Zend/tests/bug68446.phpt
Zend/tests/closure_027.phpt
Zend/tests/ns_071.phpt
Zend/tests/ns_072.phpt
Zend/tests/objects_022.phpt
Zend/tests/typehints/explicit_weak_include_strict.phpt
Zend/tests/typehints/strict_call_weak.phpt
Zend/tests/typehints/strict_call_weak_explicit.phpt
Zend/tests/typehints/weak_include_strict.phpt
Zend/tests/variadic/typehint_error.phpt
Zend/zend_execute.c
tests/classes/autoload_009.phpt
tests/classes/type_hinting_001.phpt
tests/classes/type_hinting_002.phpt
tests/classes/type_hinting_003.phpt
tests/lang/bug24658.phpt
tests/lang/catchable_error_001.phpt
tests/lang/type_hints_001.phpt

index f5cc76de1d2dd3a8b112d1b4311a15eb5a88340f..bad724679a91d66e2132c389e3ac764b1b71e542 100644 (file)
@@ -14,6 +14,6 @@ foo(123);
 
 Fatal error: Uncaught TypeException: Argument 1 passed to foo() must be of the type array, integer given, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php:2
 Stack trace:
-#0 %s(%d): foo()
+#0 %s(%d): foo(123)
 #1 {main}
   thrown in %sarray_type_hint_001.php on line 2
index 80ed7c897f8238a33cb23e35bd286677118a8ec7..87cce6fb351c9a4a10b020cf5cfb0d491e1c7a6c 100644 (file)
@@ -23,6 +23,6 @@ echo "Done\n";
 --EXPECTF--    
 Fatal error: Uncaught TypeException: Argument 1 passed to test() must be an instance of OtherClassName, instance of ClassName given, called in %s on line %d and defined in %s:%d
 Stack trace:
-#0 %s(%d): test()
+#0 %s(%d): test(Object(ClassName))
 #1 {main}
   thrown in %s on line %d
index abbac47c9ec30e47a345a0520c35a309c2666de2..9b7482f727d30e2e4b59e0977e37995a8424d5a0 100644 (file)
@@ -39,6 +39,6 @@ ok
 
 Fatal error: Uncaught TypeException: Argument 1 passed to foo\test5() must be an instance of bar, instance of foo\bar given, called in %sbug42802.php on line %d and defined in %sbug42802.php:%d
 Stack trace:
-#0 %s(%d): foo\test5()
+#0 %s(%d): foo\test5(Object(foo\bar))
 #1 {main}
   thrown in %sbug42802.php on line %d
index 6506f9c591f2569055857c68af6b33ea6575881d..ce4ce52833d9132af78518620c9b78d3fb4f695c 100644 (file)
@@ -14,6 +14,6 @@ $foo->bar(new \stdclass); // Error, ok!
 --EXPECTF--
 Fatal error: Uncaught TypeException: Argument 1 passed to foobar\foo::bar() must be an instance of foobar\foo, instance of stdClass given, called in %sbug43332_1.php on line 10 and defined in %sbug43332_1.php:5
 Stack trace:
-#0 %s(%d): foobar\foo->bar()
+#0 %s(%d): foobar\foo->bar(Object(stdClass))
 #1 {main}
   thrown in %sbug43332_1.php on line 5
index 6a7f9148109b7264b5736f5e87e886e5884d3fa2..a9507b89da57072c11bb5466b364abd55d398282 100644 (file)
@@ -34,7 +34,7 @@ array(1) {
 
 Fatal error: Uncaught TypeException: Argument 1 passed to a() must be of the type array, null given, called in %s on line %d and defined in %s:%d
 Stack trace:
-#0 %s(%d): a()
+#0 %s(%d): a(NULL)
 #1 {main}
   thrown in %s on line %d
 
index 7024a93c557224d144dc28372905db61286c1173..0b604c3ac473d8759b97221f2d54112f165a9883 100644 (file)
@@ -30,6 +30,6 @@ NULL
 
 Fatal error: Uncaught TypeException: Argument 1 passed to test() must be an instance of Closure, instance of stdClass given, called in %s on line %d and defined in %s:%d
 Stack trace:
-#0 %s(%d): test()
+#0 %s(%d): test(Object(stdClass))
 #1 {main}
   thrown in %s on line %d
index 08a0b898d644aa6ff2b2478103608a9c5b7327d7..7dbca07b8d2191659d34668903f83821a6bd2cee 100644 (file)
@@ -20,6 +20,6 @@ NULL
 
 Fatal error: Uncaught TypeException: Argument 1 passed to foo\bar::__construct() must be of the type array, object given, called in %s on line %d and defined in %s:%d
 Stack trace:
-#0 %s(%d): foo\bar->__construct()
+#0 %s(%d): foo\bar->__construct(Object(stdClass))
 #1 {main}
   thrown in %s on line %d
index 95f8f95045276bd05ea99efbb798e5cd7992a136..c797cf0fac2e5093f1e595ca7977711e961f11f7 100644 (file)
@@ -32,6 +32,6 @@ NULL
 
 Fatal error: Uncaught TypeException: Argument 1 passed to foo\bar::__construct() must implement interface foo\foo, instance of stdClass given, called in %s on line %d and defined in %s:%d
 Stack trace:
-#0 %s(%d): foo\bar->__construct()
+#0 %s(%d): foo\bar->__construct(Object(stdClass))
 #1 {main}
   thrown in %s on line %d
index e96a6aa1636a419b9c748f965d54f310642fcbbf..982b2d1a6272086305aebf8f69ebfffef8fe42be 100644 (file)
@@ -38,6 +38,6 @@ object(baz)#%d (0) {
 
 Fatal error: Uncaught TypeException: Argument 1 passed to foo::testFoo() must be an instance of foo, instance of stdClass given, called in %s on line %d and defined in %s:%d
 Stack trace:
-#0 %s(%d): foo->testFoo()
+#0 %s(%d): foo->testFoo(Object(stdClass))
 #1 {main}
   thrown in %s on line %d
index d39c6b6a0aa5e83dc79ac54c05005ae84fbc52c6..579ebcb3c0de5c44b47f7629e254437234b56310 100644 (file)
@@ -13,7 +13,7 @@ require 'weak_include_strict_2.inc';
 --EXPECTF--
 Fatal error: Uncaught TypeException: Argument 1 passed to takes_int() must be of the type integer, float given, called in %sweak_include_strict_2.inc on line 9 and defined in %sweak_include_strict_2.inc:5
 Stack trace:
-#0 %s(%d): takes_int()
+#0 %s(%d): takes_int(1)
 #1 %s(%d): require('%s')
 #2 {main}
   thrown in %sweak_include_strict_2.inc on line 5
index 3b92244824049c07a268013a1748c6c9c1873f67..5031644a7f15a1b43252b8ddcc729693f1f9df30 100644 (file)
@@ -15,7 +15,7 @@ function_declared_in_weak_mode(1.0);
 --EXPECTF--
 Fatal error: Uncaught TypeException: Argument 1 passed to function_declared_in_weak_mode() must be of the type integer, float given, called in %sstrict_call_weak.php on line 10 and defined in %sstrict_call_weak_2.inc:5
 Stack trace:
-#0 %s(%d): function_declared_in_weak_mode()
+#0 %s(%d): function_declared_in_weak_mode(1)
 #1 {main}
   thrown in %sstrict_call_weak_2.inc on line 5
 
index fdb92fcf29d33cc835bcbeb46d5d87806c02e024..37f527bb0b0f40ad49bcaaefb6ace2ae605c10d6 100644 (file)
@@ -15,7 +15,7 @@ function_declared_in_weak_mode(1.0);
 --EXPECTF--
 Fatal error: Uncaught TypeException: Argument 1 passed to function_declared_in_weak_mode() must be of the type integer, float given, called in %sstrict_call_weak_explicit.php on line 10 and defined in %sstrict_call_weak_explicit_2.inc:5
 Stack trace:
-#0 %s(%d): function_declared_in_weak_mode()
+#0 %s(%d): function_declared_in_weak_mode(1)
 #1 {main}
   thrown in %sstrict_call_weak_explicit_2.inc on line 5
 
index 4d91e7baa8f0a0151f830d2873e5cb93fadd7855..da7c7a4d13cf1d2a8032765baca751277e1128b9 100644 (file)
@@ -13,7 +13,7 @@ require 'weak_include_strict_2.inc';
 --EXPECTF--
 Fatal error: Uncaught TypeException: Argument 1 passed to takes_int() must be of the type integer, float given, called in %sweak_include_strict_2.inc on line 9 and defined in %sweak_include_strict_2.inc:5
 Stack trace:
-#0 %s(%d): takes_int()
+#0 %s(%d): takes_int(1)
 #1 %s(%d): require('%s')
 #2 {main}
   thrown in %sweak_include_strict_2.inc on line 5
index f901147dc5d5c87d5f385508308c11ebb89382be..2cbe2f32a201c299926a954e116e0704bf81ab03 100644 (file)
@@ -35,6 +35,6 @@ array(3) {
 
 Fatal error: Uncaught TypeException: Argument 3 passed to test() must be of the type array, integer given, called in %s:%d
 Stack trace:
-#0 %s(%d): test(Array, Array)
+#0 %s(%d): test(Array, Array, 2)
 #1 {main}
   thrown in %s on line %d
index d29014d3b2fa84f6a9f641f695c62fa903aea1bb..1be3de41a2a77e6091b07ae1891cf7c3b9115c6b 100644 (file)
@@ -593,7 +593,6 @@ ZEND_API void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, c
        const char *fname = zf->common.function_name->val;
        const char *fsep;
        const char *fclass;
-       zval old_arg;
 
        if (zf->common.scope) {
                fsep =  "::";
@@ -604,11 +603,6 @@ ZEND_API void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, c
        }
 
        if (zf->common.type == ZEND_USER_FUNCTION) {
-               if (arg) {
-                       ZVAL_COPY_VALUE(&old_arg, arg);
-                       ZVAL_UNDEF(arg);
-               }
-
                if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
                        zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d",
                                        arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind,
@@ -616,10 +610,6 @@ ZEND_API void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, c
                } else {
                        zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
                }
-
-               if (arg) {
-                       ZVAL_COPY_VALUE(arg, &old_arg);
-               }
        } else {
                zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
        }
index 2af2d9adc4aff6a15b2b438f4d42cd3bdd1aef32..b25d7eb69de4b682ae1fd4a16577466b63474542 100644 (file)
@@ -16,6 +16,6 @@ Ensure type hints for unknown types do not trigger autoload.
 --EXPECTF--
 Fatal error: Uncaught TypeException: Argument 1 passed to f() must be an instance of UndefClass, instance of stdClass given, called in %s on line %d and defined in %s:%d
 Stack trace:
-#0 %s(%d): f()
+#0 %s(%d): f(Object(stdClass))
 #1 {main}
   thrown in %s on line %d
index 393f15716701f16b1d1296e13ec5548dff4fb4e9..da3de4611f3de419676f49a47d2984a422330a4c 100644 (file)
@@ -37,6 +37,6 @@ $a->b($b);
 
 Fatal error: Uncaught TypeException: Argument 1 passed to FooBar::a() must implement interface Foo, instance of Blort given, called in %s on line 27 and defined in %s:12
 Stack trace:
-#0 %s(%d): FooBar->a()
+#0 %s(%d): FooBar->a(Object(Blort))
 #1 {main}
   thrown in %s on line 12
index 1ebceb4549e1ec1e2c093df616f4a2c7deee1a8d..1988e24d977b831273394ffe6075b61c3b680d2b 100644 (file)
@@ -15,6 +15,6 @@ $o->a($o);
 --EXPECTF--
 Fatal error: Uncaught TypeException: Argument 1 passed to Foo::a() must be an instance of NonExisting, instance of Foo given, called in %s on line %d and defined in %s:%d
 Stack trace:
-#0 %s(%d): Foo->a()
+#0 %s(%d): Foo->a(Object(Foo))
 #1 {main}
   thrown in %s on line %d
index d8734b11366365c98394f65cd420a6d76263de86..a58c579dc52dc25d44ccb3b4095c88960f635247 100644 (file)
@@ -59,6 +59,6 @@ array(1) {
 
 Fatal error: Uncaught TypeException: Argument 1 passed to Test::f1() must be of the type array, integer given, called in %s on line %d and defined in %s:%d
 Stack trace:
-#0 %s(%d): Test::f1()
+#0 %s(%d): Test::f1(1)
 #1 {main}
   thrown in %s on line %d
index 236d8ed394f0af8e6d518dec66e095a39ed0a510..6e57d9b66b921aca1ea4f1622c4de1c57a01183b 100644 (file)
@@ -55,7 +55,7 @@ object(foo)#%d (0) {
 
 Fatal error: Uncaught TypeException: Argument 1 passed to typehint() must be an instance of foo, integer given in %s:%d
 Stack trace:
-#0 [internal function]: typehint(1)
+#0 [internal function]: typehint(1, 1)
 #1 %s(%d): array_walk(Array, 'typehint')
 #2 {main}
   thrown in %s on line %d
index f58b26e847160f8270caf5e5426939cf8090b095..4343ac0e8f81ec2388a516d0ecc5a0b08ec3677f 100644 (file)
@@ -21,6 +21,6 @@ Catchable fatal error [1]
 --EXPECTF--
 Fatal error: Uncaught TypeException: Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_001.php on line 15 and defined in %scatchable_error_001.php:5
 Stack trace:
-#0 %s(%d): blah()
+#0 %s(%d): blah(Object(stdClass))
 #1 {main}
   thrown in %scatchable_error_001.php on line 5
index 71ef9f30c3f1cb8f0fe31421e66d07a9d8510b8d..0a061b7d9eabdac1c98b74c303323a42f3f29fcb 100644 (file)
@@ -25,6 +25,6 @@ type_hint_foo($bar);
 
 Fatal error: Uncaught TypeException: Argument 1 passed to type_hint_foo() must be an instance of Foo, instance of Bar given, called in %s on line 16 and defined in %s:9
 Stack trace:
-#0 %s(%d): type_hint_foo()
+#0 %s(%d): type_hint_foo(Object(Bar))
 #1 {main}
   thrown in %s on line 9