mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Refactor error messages to only append defined in the event of rendering as a fatal error. Fix relative typehints to not work
This commit is contained in:
parent
1df033c5cd
commit
724f7118f1
@ -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
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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
|
@ -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
|
@ -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
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user