]> granicus.if.org Git - php/commitdiff
Refactor error messages to only append defined in the event of rendering as a fatal...
authorAnthony Ferrara <ircmaxell@gmail.com>
Wed, 18 Mar 2015 20:38:51 +0000 (16:38 -0400)
committerAnthony Ferrara <ircmaxell@gmail.com>
Wed, 18 Mar 2015 20:38:51 +0000 (16:38 -0400)
Zend/tests/typehints/scalar_basic.phpt
Zend/tests/typehints/scalar_none.phpt
Zend/tests/typehints/scalar_null.phpt
Zend/tests/typehints/scalar_relative_typehint_disallowed.phpt [new file with mode: 0644]
Zend/tests/typehints/scalar_strict.phpt
Zend/tests/typehints/scalar_strict_basic.phpt
Zend/tests/variadic/typehint_suppressed_error.phpt
Zend/zend_compile.c
Zend/zend_exceptions.c
Zend/zend_execute.c

index df1abe2607eac89d400eaa2c27ca2ba3ce6ef87c..ef632f0069df8097f6ce2a5f095f37797de9ec98 100644 (file)
@@ -79,16 +79,16 @@ E_NOTICE: A non well formed numeric value encountered on line %d
 int(1)
 
 *** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
 
 *** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
 
 *** Trying int(%d)
 int(%d)
 
 *** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
 
 *** Trying bool(true)
 int(1)
@@ -97,22 +97,22 @@ int(1)
 int(0)
 
 *** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d
 
 *** Trying array(0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d
 
 *** Trying object(stdClass)#%s (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
 
 *** Trying object(Stringable)#%s (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
 
 *** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
 
 Testing 'float' typehint:
 
@@ -133,10 +133,10 @@ E_NOTICE: A non well formed numeric value encountered on line %d
 float(1)
 
 *** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
 
 *** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
 
 *** Trying int(%d)
 float(%s)
@@ -151,22 +151,22 @@ float(1)
 float(0)
 
 *** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
 
 *** Trying array(0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
 
 *** Trying object(stdClass)#%s (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
 
 *** Trying object(Stringable)#%s (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
 
 *** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
 
 Testing 'string' typehint:
 
@@ -204,22 +204,22 @@ string(1) "1"
 string(0) ""
 
 *** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
 
 *** Trying array(0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
 
 *** Trying object(stdClass)#%s (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
 
 *** Trying object(Stringable)#%s (0) {
 }
 string(6) "foobar"
 
 *** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
 
 Testing 'bool' typehint:
 
@@ -257,21 +257,21 @@ bool(true)
 bool(false)
 
 *** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d
 
 *** Trying array(0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d
 
 *** Trying object(stdClass)#%s (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
 
 *** Trying object(Stringable)#%s (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
 
 *** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d
 
 Done
\ No newline at end of file
index a22e87442eb82d343e7ffd77951f4a99ee32cd6f..e450f1a16b1f736e790c783e6d4869ef2955c0dd 100644 (file)
@@ -35,13 +35,13 @@ foreach ($functions as $type => $function) {
 echo PHP_EOL . "Done";
 --EXPECTF--
 Testing int:
-*** Caught Argument 1 passed to {closure}() must be of the type integer, none given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, none given, called in %s on line %d
 Testing float:
-*** Caught Argument 1 passed to {closure}() must be of the type float, none given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, none given, called in %s on line %d
 Testing string:
-*** Caught Argument 1 passed to {closure}() must be of the type string, none given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, none given, called in %s on line %d
 Testing bool:
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, none given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, none given, called in %s on line %d
 Testing int nullable:
 NULL
 Testing float nullable:
index 4ca4d3932a13d35ebd15281804e126fdb6560509..ff6a3d4206b8cf8b70c665cec18cf6df2db79be2 100644 (file)
@@ -37,13 +37,13 @@ echo PHP_EOL . "Done";
 ?>
 --EXPECTF--
 Testing int:
-*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d
 Testing float:
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
 Testing string:
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
 Testing bool:
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d
 Testing int nullable:
 NULL
 Testing float nullable:
diff --git a/Zend/tests/typehints/scalar_relative_typehint_disallowed.phpt b/Zend/tests/typehints/scalar_relative_typehint_disallowed.phpt
new file mode 100644 (file)
index 0000000..0aea1ae
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Scalar type hint - disallow relative typehints
+--FILE--
+<?php
+
+function foo(bar\int $a): int {
+       return $a;
+}
+
+foo(10);
+
+?>
+--EXPECTF--
+Fatal error: Argument 1 passed to foo() must be an instance of bar\int, integer given, called in %s on line %d and defined in %s on line %d
\ No newline at end of file
index 783185a776af3a13f49cb37bf80a81dcdf601f3d..44c83cfbb0ef70f0d5e687c699fcca017be442c3 100644 (file)
@@ -68,52 +68,52 @@ Testing 'int' typehint:
 int(1)
 
 *** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
 
 *** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
 
 *** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
 
 *** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
 
 *** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
 
 *** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
 
 *** Trying int(9223372036854775807)
 int(9223372036854775807)
 
 *** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
 
 *** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d
 
 *** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d
 
 *** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d
 
 *** Trying array(0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d
 
 *** Trying object(stdClass)#6 (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
 
 *** Trying object(Stringable)#7 (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
 
 *** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
 
 Testing 'float' typehint:
 
@@ -121,7 +121,7 @@ Testing 'float' typehint:
 float(1)
 
 *** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
 
 *** Trying float(1)
 float(1)
@@ -130,13 +130,13 @@ float(1)
 float(1.5)
 
 *** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
 
 *** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
 
 *** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
 
 *** Trying int(9223372036854775807)
 float(9.2233720368548E+18)
@@ -145,42 +145,42 @@ float(9.2233720368548E+18)
 float(NAN)
 
 *** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d
 
 *** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d
 
 *** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
 
 *** Trying array(0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
 
 *** Trying object(stdClass)#6 (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
 
 *** Trying object(Stringable)#7 (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
 
 *** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
 
 Testing 'string' typehint:
 
 *** Trying int(1)
-*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d
 
 *** Trying string(1) "1"
 string(1) "1"
 
 *** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
 
 *** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
 
 *** Trying string(2) "1a"
 string(2) "1a"
@@ -192,63 +192,63 @@ string(1) "a"
 string(0) ""
 
 *** Trying int(9223372036854775807)
-*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d
 
 *** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
 
 *** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d
 
 *** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d
 
 *** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
 
 *** Trying array(0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
 
 *** Trying object(stdClass)#6 (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
 
 *** Trying object(Stringable)#7 (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
 
 *** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
 
 Testing 'bool' typehint:
 
 *** Trying int(1)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d
 
 *** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
 
 *** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d
 
 *** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d
 
 *** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
 
 *** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
 
 *** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
 
 *** Trying int(9223372036854775807)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d
 
 *** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d
 
 *** Trying bool(true)
 bool(true)
@@ -257,21 +257,21 @@ bool(true)
 bool(false)
 
 *** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d
 
 *** Trying array(0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d
 
 *** Trying object(stdClass)#6 (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
 
 *** Trying object(Stringable)#7 (0) {
 }
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
 
 *** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d
 
 Done
\ No newline at end of file
index 2ad00ed39d1cb8bd3d2235373f726eea0a463f5d..dcbf93135db5fff39f9aea4c77be1b2d89709a29 100644 (file)
@@ -68,28 +68,28 @@ Testing 'int' typehint:
 int(1)
 
 *** Trying float value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, float given, called in %s on line %d
 
 *** Trying string value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, string given, called in %s on line %d
 
 *** Trying true value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d
 
 *** Trying false value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, boolean given, called in %s on line %d
 
 *** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, null given, called in %s on line %d
 
 *** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, array given, called in %s on line %d
 
 *** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, object given, called in %s on line %d
 
 *** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type integer, resource given, called in %s on line %d
 
 Testing 'float' typehint:
 
@@ -100,65 +100,65 @@ float(1)
 float(1)
 
 *** Trying string value
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
 
 *** Trying true value
-*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d
 
 *** Trying false value
-*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, boolean given, called in %s on line %d
 
 *** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
 
 *** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
 
 *** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
 
 *** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
 
 Testing 'string' typehint:
 
 *** Trying integer value
-*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, integer given, called in %s on line %d
 
 *** Trying float value
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
 
 *** Trying string value
 string(1) "1"
 
 *** Trying true value
-*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d
 
 *** Trying false value
-*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, boolean given, called in %s on line %d
 
 *** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
 
 *** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
 
 *** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
 
 *** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
 
 Testing 'bool' typehint:
 
 *** Trying integer value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, integer given, called in %s on line %d
 
 *** Trying float value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, float given, called in %s on line %d
 
 *** Trying string value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, string given, called in %s on line %d
 
 *** Trying true value
 bool(true)
@@ -167,15 +167,15 @@ bool(true)
 bool(false)
 
 *** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, null given, called in %s on line %d
 
 *** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, array given, called in %s on line %d
 
 *** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, object given, called in %s on line %d
 
 *** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d and defined in %s on line %d
+*** Caught Argument 1 passed to {closure}() must be of the type boolean, resource given, called in %s on line %d
 
 Done
\ No newline at end of file
index f72de5c69eeff453ae57de3bfd8c202ba47cfdf5..5879de6d954d109537e03e3685ddbf8a7442baf6 100644 (file)
@@ -15,4 +15,4 @@ try {
 
 ?>
 --EXPECTF--
-string(%d) "Argument 3 passed to test() must be of the type array, integer given, called in %s on line %d and defined in %s on line %d"
+string(%d) "Argument 3 passed to test() must be of the type array, integer given, called in %s on line %d"
index 1ec6a11c971aab314f62d29b78b49f7bf9609b31..c44790dd9e089807ceadb4c84794037efcc79223 100644 (file)
@@ -129,13 +129,13 @@ static zend_bool zend_get_unqualified_name(const zend_string *name, const char *
 }
 /* }}} */
 
-struct _scalar_typehint_info {
+typedef struct _scalar_typehint_info {
        const char* name;
        const size_t name_len;
        const zend_uchar type;
-};
+} scalar_typehint_info;
 
-static const struct _scalar_typehint_info scalar_typehints[] = {
+static const scalar_typehint_info scalar_typehints[] = {
        {"int", sizeof("int") - 1, IS_LONG},
        {"float", sizeof("float") - 1, IS_DOUBLE},
        {"string", sizeof("string") - 1, IS_STRING},
@@ -143,19 +143,12 @@ static const struct _scalar_typehint_info scalar_typehints[] = {
        {NULL, 0, IS_UNDEF}
 };
 
-static zend_always_inline const struct _scalar_typehint_info* zend_find_scalar_typehint(const zend_string *const_name) /* {{{ */
+static zend_always_inline const scalar_typehint_info* zend_find_scalar_typehint(const zend_string *const_name) /* {{{ */
 {
-       const struct _scalar_typehint_info *info = &scalar_typehints[0];
-       const char *uqname;
-       size_t uqname_len;
+       const scalar_typehint_info *info = &scalar_typehints[0];
 
-       if (!zend_get_unqualified_name(const_name, &uqname, &uqname_len)) {
-               uqname = const_name->val;
-               uqname_len = const_name->len;
-       }
-       
        while (info->name) {
-               if (uqname_len == info->name_len && zend_binary_strcasecmp(uqname, uqname_len, info->name, info->name_len) == 0) {
+               if (const_name->len == info->name_len && zend_binary_strcasecmp(const_name->val, const_name->len, info->name, info->name_len) == 0) {
                        break;
                }
                info++;
@@ -171,7 +164,7 @@ static zend_always_inline const struct _scalar_typehint_info* zend_find_scalar_t
 
 ZEND_API void zend_assert_valid_class_name(const zend_string *const_name) /* {{{ */
 {      
-       const struct _scalar_typehint_info *info = zend_find_scalar_typehint(const_name);
+       const scalar_typehint_info *info = zend_find_scalar_typehint(const_name);
        
        if (info) {
                zend_error_noreturn(E_COMPILE_ERROR, "\"%s\" cannot be used as a class name", info->name);
@@ -181,7 +174,7 @@ ZEND_API void zend_assert_valid_class_name(const zend_string *const_name) /* {{{
 
 static zend_always_inline zend_uchar zend_lookup_scalar_typehint_by_name(const zend_string *const_name) /* {{{ */
 {      
-       const struct _scalar_typehint_info *info = zend_find_scalar_typehint(const_name);
+       const scalar_typehint_info *info = zend_find_scalar_typehint(const_name);
        
        if (info) {
                return info->type;
index 2a8af1bf28dd451ab2ad5cdb286e1e6075917280..46ad207087adcfa038cc40b185a7a0977d8c314f 100644 (file)
@@ -909,7 +909,12 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */
                zend_long line = zval_get_long(GET_PROPERTY_SILENT(&exception, "line"));
                zend_long code = zval_get_long(GET_PROPERTY_SILENT(&exception, "code"));
 
-               zend_error_helper(code, file->val, line, "%s", message->val);
+               if (ce_exception == type_exception_ce) {
+                       zend_error_helper(code, file->val, line, "%s and defined", message->val);
+               } else {
+                       zend_error_helper(code, file->val, line, "%s", message->val);
+               }
+
                zend_string_release(file);
                zend_string_release(message);
                OBJ_RELEASE(ex);
index 0fed8416975b28c54b322fd26b70068d3c94c74f..a6170c7c62671ce2d2399be265b86d3bd9da1e82 100644 (file)
@@ -621,10 +621,9 @@ ZEND_API void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, c
                }
 
                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 and defined in %s on line %d", 
+                       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, 
-                                       ptr->func->op_array.filename->val, ptr->opline->lineno,
-                                       zf->op_array.filename->val, EG(current_execute_data)->opline->lineno);
+                                       ptr->func->op_array.filename->val, ptr->opline->lineno);
                } 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);
                }