Commit da78fab1ffe for php.net
commit da78fab1ffe002c06e176e75b912dc23038ff347
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Sat Aug 22 20:26:41 2026 +0700
Zend: applied fixers to improve test robustness (part 7/8) (#23315)
diff --git a/Zend/tests/type_declarations/scalar_none.phpt b/Zend/tests/type_declarations/scalar_none.phpt
index 8316b51fa9e..764f6a8a574 100644
--- a/Zend/tests/type_declarations/scalar_none.phpt
+++ b/Zend/tests/type_declarations/scalar_none.phpt
@@ -19,20 +19,20 @@
try {
var_dump($function());
} catch (Throwable $e) {
- echo "*** Caught " . $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
echo PHP_EOL . "Done";
?>
--EXPECTF--
Testing int:
-*** Caught Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected
+ArgumentCountError: Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected
Testing float:
-*** Caught Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected
+ArgumentCountError: Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected
Testing string:
-*** Caught Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected
+ArgumentCountError: Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected
Testing bool:
-*** Caught Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected
+ArgumentCountError: Too few arguments to function {closure:%s:%d}(), 0 passed in %s on line %d and exactly 1 expected
Testing int nullable:
NULL
Testing float nullable:
diff --git a/Zend/tests/type_declarations/scalar_null.phpt b/Zend/tests/type_declarations/scalar_null.phpt
index f69aec3b5b6..fb7c52ba2fa 100644
--- a/Zend/tests/type_declarations/scalar_null.phpt
+++ b/Zend/tests/type_declarations/scalar_null.phpt
@@ -18,8 +18,8 @@
echo "Testing $type:", PHP_EOL;
try {
var_dump($function(null));
- } catch (TypeError $e) {
- echo "*** Caught " . $e->getMessage() . PHP_EOL;
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -27,13 +27,13 @@
?>
--EXPECTF--
Testing int:
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
Testing float:
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
Testing string:
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
Testing bool:
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
Testing int nullable:
NULL
Testing float nullable:
diff --git a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
index 498092e8ac5..e3cf8927662 100644
--- a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
+++ b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
@@ -54,8 +54,8 @@ public function __toString() {
var_dump($value);
try {
var_dump($function($value));
- } catch (TypeError $e) {
- echo "*** Caught ", $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine(), PHP_EOL;
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), ' in ', $e->getFile(), ' on line ', $e->getLine(), "\n";
}
}
}
@@ -74,32 +74,32 @@ public function __toString() {
E_DEPRECATED: Implicit conversion from float 1.5 to int loses precision on line %d
int(1)
*** Trying string(2) "1a"
-*** Caught {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(1) "a"
-*** Caught {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(0) ""
-*** Caught {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type int, string returned in %s on line %d
*** Trying int(9223372036854775807)
int(9223372036854775807)
*** Trying float(NAN)
-*** Caught {closure:%s:%d}(): Return value must be of type int, float returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type int, float returned in %s on line %d
*** Trying bool(true)
int(1)
*** Trying bool(false)
int(0)
*** Trying NULL
-*** Caught {closure:%s:%d}(): Return value must be of type int, null returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type int, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type int, array returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type int, array returned in %s on line %d
*** Trying object(stdClass)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type int, stdClass returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type int, stdClass returned in %s on line %d
*** Trying object(StringCapable)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type int, StringCapable returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type int, StringCapable returned in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Return value must be of type int, resource returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type int, resource returned in %s on line %d
Testing 'float' type:
*** Trying int(1)
@@ -111,11 +111,11 @@ public function __toString() {
*** Trying float(1.5)
float(1.5)
*** Trying string(2) "1a"
-*** Caught {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(1) "a"
-*** Caught {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(0) ""
-*** Caught {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type float, string returned in %s on line %d
*** Trying int(9223372036854775807)
float(9.223372036854776E+18)
*** Trying float(NAN)
@@ -125,18 +125,18 @@ public function __toString() {
*** Trying bool(false)
float(0)
*** Trying NULL
-*** Caught {closure:%s:%d}(): Return value must be of type float, null returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type float, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type float, array returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type float, array returned in %s on line %d
*** Trying object(stdClass)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type float, stdClass returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type float, stdClass returned in %s on line %d
*** Trying object(StringCapable)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type float, StringCapable returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type float, StringCapable returned in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Return value must be of type float, resource returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type float, resource returned in %s on line %d
Testing 'string' type:
*** Trying int(1)
@@ -163,18 +163,18 @@ public function __toString() {
*** Trying bool(false)
string(0) ""
*** Trying NULL
-*** Caught {closure:%s:%d}(): Return value must be of type string, null returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type string, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type string, array returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type string, array returned in %s on line %d
*** Trying object(stdClass)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type string, stdClass returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type string, stdClass returned in %s on line %d
*** Trying object(StringCapable)#%d (0) {
}
string(6) "foobar"
*** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Return value must be of type string, resource returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type string, resource returned in %s on line %d
Testing 'bool' type:
*** Trying int(1)
@@ -201,17 +201,17 @@ public function __toString() {
*** Trying bool(false)
bool(false)
*** Trying NULL
-*** Caught {closure:%s:%d}(): Return value must be of type bool, null returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type bool, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type bool, array returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type bool, array returned in %s on line %d
*** Trying object(stdClass)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type bool, stdClass returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type bool, stdClass returned in %s on line %d
*** Trying object(StringCapable)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Return value must be of type bool, StringCapable returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type bool, StringCapable returned in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Return value must be of type bool, resource returned in %s on line %d
+TypeError: {closure:%s:%d}(): Return value must be of type bool, resource returned in %s on line %d
Done
diff --git a/Zend/tests/type_declarations/scalar_strict_64bit.phpt b/Zend/tests/type_declarations/scalar_strict_64bit.phpt
index b7f2ce0de43..fe3012b83c0 100644
--- a/Zend/tests/type_declarations/scalar_strict_64bit.phpt
+++ b/Zend/tests/type_declarations/scalar_strict_64bit.phpt
@@ -45,8 +45,8 @@ public function __toString() {
var_dump($value);
try {
var_dump($function($value));
- } catch (TypeError $e) {
- echo "*** Caught " . $e->getMessage() . PHP_EOL;
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
@@ -60,52 +60,52 @@ public function __toString() {
int(1)
*** Trying string(1) "1"
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying float(1)
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying string(2) "1a"
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying int(9223372036854775807)
int(9223372036854775807)
*** Trying float(NAN)
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying bool(true)
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d
*** Trying bool(false)
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d
*** Trying NULL
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
*** Trying object(stdClass)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
*** Trying object(StringCapable)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
Testing 'float' type:
@@ -113,7 +113,7 @@ public function __toString() {
float(1)
*** Trying string(1) "1"
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying float(1)
float(1)
@@ -122,13 +122,13 @@ public function __toString() {
float(1.5)
*** Trying string(2) "1a"
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying int(9223372036854775807)
float(9.223372036854776E+18)
@@ -137,42 +137,42 @@ public function __toString() {
float(NAN)
*** Trying bool(true)
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d
*** Trying bool(false)
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d
*** Trying NULL
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
*** Trying object(stdClass)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
*** Trying object(StringCapable)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
Testing 'string' type:
*** Trying int(1)
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
*** Trying string(1) "1"
string(1) "1"
*** Trying float(1)
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying string(2) "1a"
string(2) "1a"
@@ -184,63 +184,63 @@ public function __toString() {
string(0) ""
*** Trying int(9223372036854775807)
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
*** Trying float(NAN)
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying bool(true)
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d
*** Trying bool(false)
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d
*** Trying NULL
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
*** Trying object(stdClass)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
*** Trying object(StringCapable)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
Testing 'bool' type:
*** Trying int(1)
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
*** Trying string(1) "1"
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying float(1)
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying string(2) "1a"
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying int(9223372036854775807)
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
*** Trying float(NAN)
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying bool(true)
bool(true)
@@ -249,21 +249,21 @@ public function __toString() {
bool(false)
*** Trying NULL
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
*** Trying object(stdClass)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
*** Trying object(StringCapable)#%d (0) {
}
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
Done
diff --git a/Zend/tests/type_declarations/scalar_strict_basic.phpt b/Zend/tests/type_declarations/scalar_strict_basic.phpt
index 462bed7983d..2cc3430e912 100644
--- a/Zend/tests/type_declarations/scalar_strict_basic.phpt
+++ b/Zend/tests/type_declarations/scalar_strict_basic.phpt
@@ -43,8 +43,8 @@ function type($value) {
echo PHP_EOL . "*** Trying ", type($value), " value", PHP_EOL;
try {
var_dump($function($value));
- } catch (TypeError $e) {
- echo "*** Caught " . $e->getMessage() . PHP_EOL;
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
@@ -57,28 +57,28 @@ function type($value) {
int(1)
*** Trying float value
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying string value
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying true value
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, true given, called in %s on line %d
*** Trying false value
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, false given, called in %s on line %d
*** Trying null value
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
*** Trying array value
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
*** Trying object value
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
*** Trying resource value
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
Testing 'float' type:
@@ -89,65 +89,65 @@ function type($value) {
float(1)
*** Trying string value
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying true value
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, true given, called in %s on line %d
*** Trying false value
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, false given, called in %s on line %d
*** Trying null value
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
*** Trying array value
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
*** Trying object value
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
*** Trying resource value
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
Testing 'string' type:
*** Trying integer value
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
*** Trying float value
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying string value
string(1) "1"
*** Trying true value
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, true given, called in %s on line %d
*** Trying false value
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, false given, called in %s on line %d
*** Trying null value
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
*** Trying array value
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
*** Trying object value
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
*** Trying resource value
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
Testing 'bool' type:
*** Trying integer value
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
*** Trying float value
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying string value
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying true value
bool(true)
@@ -156,15 +156,15 @@ function type($value) {
bool(false)
*** Trying null value
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
*** Trying array value
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
*** Trying object value
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
*** Trying resource value
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
Done
diff --git a/Zend/tests/type_declarations/static_type_return.phpt b/Zend/tests/type_declarations/static_type_return.phpt
index 0d37a800465..069916cf015 100644
--- a/Zend/tests/type_declarations/static_type_return.phpt
+++ b/Zend/tests/type_declarations/static_type_return.phpt
@@ -36,8 +36,8 @@ class C extends B {}
var_dump($a->test2());
try {
var_dump($b->test2());
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -48,8 +48,8 @@ class C extends B {}
var_dump($a->test4());
try {
var_dump($b->test4());
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -59,8 +59,8 @@ class C extends B {}
try {
var_dump($test(new stdClass));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$test = $test->bindTo($a);
@@ -75,7 +75,7 @@ class C extends B {}
object(A)#%d (0) {
}
-A::test2(): Return value must be of type B, A returned
+TypeError: A::test2(): Return value must be of type B, A returned
object(A)#%d (0) {
}
@@ -84,8 +84,8 @@ class C extends B {}
object(A)#%d (0) {
}
-A::test4(): Return value must be of type B|array, A returned
+TypeError: A::test4(): Return value must be of type B|array, A returned
-{closure:%s:%d}(): Return value must be of type static, stdClass returned
+TypeError: {closure:%s:%d}(): Return value must be of type static, stdClass returned
object(A)#%d (0) {
}
diff --git a/Zend/tests/type_declarations/typed_class_constants_ast_print.phpt b/Zend/tests/type_declarations/typed_class_constants_ast_print.phpt
index dd4957f2269..b62b7263c8a 100644
--- a/Zend/tests/type_declarations/typed_class_constants_ast_print.phpt
+++ b/Zend/tests/type_declarations/typed_class_constants_ast_print.phpt
@@ -7,12 +7,12 @@
assert(false && new class {
public const int X = 1;
});
-} catch (AssertionError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(false && new class {
+AssertionError: assert(false && new class {
public const int X = 1;
})
diff --git a/Zend/tests/type_declarations/typed_class_constants_diamond_error1.phpt b/Zend/tests/type_declarations/typed_class_constants_diamond_error1.phpt
index 059c3cb2005..432061f008a 100644
--- a/Zend/tests/type_declarations/typed_class_constants_diamond_error1.phpt
+++ b/Zend/tests/type_declarations/typed_class_constants_diamond_error1.phpt
@@ -8,9 +8,9 @@ class A {
try {
define("C", new A());
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Undefined constant "C"
+Error: Undefined constant "C"
diff --git a/Zend/tests/type_declarations/typed_class_constants_inheritance_success2.phpt b/Zend/tests/type_declarations/typed_class_constants_inheritance_success2.phpt
index 40e079c3596..9091bb80f9f 100644
--- a/Zend/tests/type_declarations/typed_class_constants_inheritance_success2.phpt
+++ b/Zend/tests/type_declarations/typed_class_constants_inheritance_success2.phpt
@@ -45,4 +45,4 @@ class B extends A {
object(Z)#%d (%d) {
}
object(Z)#%d (%d) {
-}
\ No newline at end of file
+}
diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error11.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error11.phpt
index 714e5a00995..87c08de2cb6 100644
--- a/Zend/tests/type_declarations/typed_class_constants_type_error11.phpt
+++ b/Zend/tests/type_declarations/typed_class_constants_type_error11.phpt
@@ -12,10 +12,10 @@ enum E2 {
try {
var_dump(E1::C);
-} catch (TypeError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign E2 to class constant E1::C of type static
+TypeError: Cannot assign E2 to class constant E1::C of type static
diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error2.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error2.phpt
index 8acffaa3839..b23d78a55e6 100644
--- a/Zend/tests/type_declarations/typed_class_constants_type_error2.phpt
+++ b/Zend/tests/type_declarations/typed_class_constants_type_error2.phpt
@@ -10,17 +10,17 @@ class A {
try {
var_dump(A::CONST1);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(A::CONST1);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign string to class constant A::CONST1 of type int
-Cannot assign string to class constant A::CONST1 of type int
+TypeError: Cannot assign string to class constant A::CONST1 of type int
+TypeError: Cannot assign string to class constant A::CONST1 of type int
diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error3.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error3.phpt
index 1e6ab277dec..bc98e08d6e9 100644
--- a/Zend/tests/type_declarations/typed_class_constants_type_error3.phpt
+++ b/Zend/tests/type_declarations/typed_class_constants_type_error3.phpt
@@ -10,16 +10,16 @@ class A {
try {
var_dump(A::CONST1);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(A::CONST1);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign stdClass to class constant A::CONST1 of type string
-Cannot assign stdClass to class constant A::CONST1 of type string
+TypeError: Cannot assign stdClass to class constant A::CONST1 of type string
+TypeError: Cannot assign stdClass to class constant A::CONST1 of type string
diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error7.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error7.phpt
index 6fce7501663..06bbd27e5d3 100644
--- a/Zend/tests/type_declarations/typed_class_constants_type_error7.phpt
+++ b/Zend/tests/type_declarations/typed_class_constants_type_error7.phpt
@@ -10,16 +10,16 @@ class A {
try {
var_dump(A::CONST1);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(A::CONST1);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
-Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
+TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
+TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error8.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error8.phpt
index cbd3720a5ea..ecc82482c88 100644
--- a/Zend/tests/type_declarations/typed_class_constants_type_error8.phpt
+++ b/Zend/tests/type_declarations/typed_class_constants_type_error8.phpt
@@ -11,30 +11,30 @@ class A {
try {
var_dump(A::CONST2);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(A::CONST2);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(A::CONST1);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(A::CONST1);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
-Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
-Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
-Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
+TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
+TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
+TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
+TypeError: Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable
diff --git a/Zend/tests/type_declarations/typed_class_constants_type_error9.phpt b/Zend/tests/type_declarations/typed_class_constants_type_error9.phpt
index b0f42b2078a..7094d7bf242 100644
--- a/Zend/tests/type_declarations/typed_class_constants_type_error9.phpt
+++ b/Zend/tests/type_declarations/typed_class_constants_type_error9.phpt
@@ -17,9 +17,9 @@ class A {
try {
var_dump(A::S);
-} catch (TypeError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign S to class constant A::S of type string
+TypeError: Cannot assign S to class constant A::S of type string
diff --git a/Zend/tests/type_declarations/typed_properties_019.phpt b/Zend/tests/type_declarations/typed_properties_019.phpt
index d804b9c799d..244fe0dd1e7 100644
--- a/Zend/tests/type_declarations/typed_properties_019.phpt
+++ b/Zend/tests/type_declarations/typed_properties_019.phpt
@@ -14,9 +14,9 @@ public function inc() {
try {
$foo->inc();
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot increment property Foo::$bar of type int past its maximal value
+TypeError: Cannot increment property Foo::$bar of type int past its maximal value
diff --git a/Zend/tests/type_declarations/typed_properties_020.phpt b/Zend/tests/type_declarations/typed_properties_020.phpt
index 3b16a9d81d0..92b4e86ad63 100644
--- a/Zend/tests/type_declarations/typed_properties_020.phpt
+++ b/Zend/tests/type_declarations/typed_properties_020.phpt
@@ -11,8 +11,8 @@ public function __construct() {
$this->bar += 2;
try {
$this->bar += 1.5;
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
@@ -22,5 +22,5 @@ public function __construct() {
var_dump($foo->bar);
?>
--EXPECT--
-Cannot assign float to property Foo::$bar of type int
+TypeError: Cannot assign float to property Foo::$bar of type int
int(2)
diff --git a/Zend/tests/type_declarations/typed_properties_021.phpt b/Zend/tests/type_declarations/typed_properties_021.phpt
index d4d4d0ed19d..1c21bf6a90c 100644
--- a/Zend/tests/type_declarations/typed_properties_021.phpt
+++ b/Zend/tests/type_declarations/typed_properties_021.phpt
@@ -8,9 +8,9 @@ class Foo {
try {
$foo = new Foo();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Class "BAR" not found
+Error: Class "BAR" not found
diff --git a/Zend/tests/type_declarations/typed_properties_033.phpt b/Zend/tests/type_declarations/typed_properties_033.phpt
index 665026f0756..76d57e4ec48 100644
--- a/Zend/tests/type_declarations/typed_properties_033.phpt
+++ b/Zend/tests/type_declarations/typed_properties_033.phpt
@@ -20,12 +20,12 @@ public function &fetch() {
foreach ($foo->fetch() as &$prop) {
$prop += 1;
}
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($foo);
?>
--EXPECTF--
-Cannot assign float to reference held by property class@anonymous::$qux of type int
+TypeError: Cannot assign float to reference held by property class@anonymous::$qux of type int
object(class@anonymous)#1 (4) {
["foo"]=>
int(2)
diff --git a/Zend/tests/type_declarations/typed_properties_034.phpt b/Zend/tests/type_declarations/typed_properties_034.phpt
index 4af6baa80ae..dcda621774a 100644
--- a/Zend/tests/type_declarations/typed_properties_034.phpt
+++ b/Zend/tests/type_declarations/typed_properties_034.phpt
@@ -22,7 +22,7 @@ function foo(?int &$a) {
try {
$foo->baz = &$foo->bar;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
$foo->bar = 10;
foreach ($foo->getIterator() as &$item) {
@@ -32,17 +32,17 @@ function foo(?int &$a) {
try {
foo($foo->bar);
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($foo);
?>
--EXPECT--
int(42)
-Cannot assign null to property class@anonymous::$baz of type int
+TypeError: Cannot assign null to property class@anonymous::$baz of type int
int(1)
int(10)
int(10)
-Cannot assign null to reference held by property class@anonymous::$baz of type int
+TypeError: Cannot assign null to reference held by property class@anonymous::$baz of type int
object(class@anonymous)#1 (2) {
["bar"]=>
&int(10)
diff --git a/Zend/tests/type_declarations/typed_properties_038.phpt b/Zend/tests/type_declarations/typed_properties_038.phpt
index 4bb5b75a28f..e9843aea359 100644
--- a/Zend/tests/type_declarations/typed_properties_038.phpt
+++ b/Zend/tests/type_declarations/typed_properties_038.phpt
@@ -9,53 +9,53 @@
try {
$foo->bar++;
-} catch(TypeError $t) {
- var_dump($t->getMessage());
+} catch(Throwable $t) {
+ echo $t::class, ': ', $t->getMessage(), "\n";
}
var_dump($foo);
try {
$foo->bar += 1;
-} catch(TypeError $t) {
- var_dump($t->getMessage());
+} catch(Throwable $t) {
+ echo $t::class, ': ', $t->getMessage(), "\n";
}
var_dump($foo);
try {
++$foo->bar;
-} catch(TypeError $t) {
- var_dump($t->getMessage());
+} catch(Throwable $t) {
+ echo $t::class, ': ', $t->getMessage(), "\n";
}
var_dump($foo);
try {
$foo->bar = $foo->bar + 1;
-} catch(TypeError $t) {
- var_dump($t->getMessage());
+} catch(Throwable $t) {
+ echo $t::class, ': ', $t->getMessage(), "\n";
}
var_dump($foo);
?>
--EXPECTF--
-string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value"
+TypeError: Cannot increment property class@anonymous::$bar of type int past its maximal value
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
-string(65) "Cannot assign float to property class@anonymous::$bar of type int"
+TypeError: Cannot assign float to property class@anonymous::$bar of type int
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
-string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value"
+TypeError: Cannot increment property class@anonymous::$bar of type int past its maximal value
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
-string(65) "Cannot assign float to property class@anonymous::$bar of type int"
+TypeError: Cannot assign float to property class@anonymous::$bar of type int
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
diff --git a/Zend/tests/type_declarations/typed_properties_043.phpt b/Zend/tests/type_declarations/typed_properties_043.phpt
index ed4951f39c3..c689c09e88f 100644
--- a/Zend/tests/type_declarations/typed_properties_043.phpt
+++ b/Zend/tests/type_declarations/typed_properties_043.phpt
@@ -11,18 +11,18 @@ trait Test {
try {
Test::$selfProp = new stdClass;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
Test::$selfNullProp = new stdClass;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
Test::$parentProp = new stdClass;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
Test::$selfNullProp = null;
@@ -42,13 +42,13 @@ class Bar extends Foo {
?>
--EXPECTF--
Deprecated: Accessing static trait property Test::$selfProp is deprecated, it should only be accessed on a class using the trait in %s on line %d
-Cannot assign stdClass to property Test::$selfProp of type self
+TypeError: Cannot assign stdClass to property Test::$selfProp of type self
Deprecated: Accessing static trait property Test::$selfNullProp is deprecated, it should only be accessed on a class using the trait in %s on line %d
-Cannot assign stdClass to property Test::$selfNullProp of type ?self
+TypeError: Cannot assign stdClass to property Test::$selfNullProp of type ?self
Deprecated: Accessing static trait property Test::$parentProp is deprecated, it should only be accessed on a class using the trait in %s on line %d
-Cannot assign stdClass to property Test::$parentProp of type parent
+TypeError: Cannot assign stdClass to property Test::$parentProp of type parent
Deprecated: Accessing static trait property Test::$selfNullProp is deprecated, it should only be accessed on a class using the trait in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_044.phpt b/Zend/tests/type_declarations/typed_properties_044.phpt
index f32cd928444..9933c15203a 100644
--- a/Zend/tests/type_declarations/typed_properties_044.phpt
+++ b/Zend/tests/type_declarations/typed_properties_044.phpt
@@ -22,13 +22,13 @@
try {
var_dump($bar++);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(++$bar);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$bar = PHP_INT_MIN;
@@ -37,13 +37,13 @@
try {
var_dump($bar--);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(--$bar);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -52,7 +52,7 @@
int(-2)
int(-1)
int(-1)
-Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value
-Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value
-Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value
-Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value
+TypeError: Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value
+TypeError: Cannot increment a reference held by property class@anonymous::$bar of type ?int past its maximal value
+TypeError: Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value
+TypeError: Cannot decrement a reference held by property class@anonymous::$bar of type ?int past its minimal value
diff --git a/Zend/tests/type_declarations/typed_properties_045.phpt b/Zend/tests/type_declarations/typed_properties_045.phpt
index 7e4dc8e43fe..07ae8012a25 100644
--- a/Zend/tests/type_declarations/typed_properties_045.phpt
+++ b/Zend/tests/type_declarations/typed_properties_045.phpt
@@ -15,8 +15,8 @@ public function test() {
var_dump($val);
try {
$val = [];
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
@@ -33,8 +33,8 @@ public function test() {
try {
$val = [];
var_dump($foo->$k);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
$foo->test();
@@ -42,10 +42,10 @@ public function test() {
--EXPECT--
int(0)
int(20)
-Cannot assign array to reference held by property Foo::$bar of type int
+TypeError: Cannot assign array to reference held by property Foo::$bar of type int
float(0.5)
float(20)
-Cannot assign array to reference held by property Foo::$baz of type float
+TypeError: Cannot assign array to reference held by property Foo::$baz of type float
float(0.5)
float(20)
-Cannot assign array to reference held by property Foo::$privateProp of type float
+TypeError: Cannot assign array to reference held by property Foo::$privateProp of type float
diff --git a/Zend/tests/type_declarations/typed_properties_046.phpt b/Zend/tests/type_declarations/typed_properties_046.phpt
index 2048455fe5f..c66a69e334f 100644
--- a/Zend/tests/type_declarations/typed_properties_046.phpt
+++ b/Zend/tests/type_declarations/typed_properties_046.phpt
@@ -18,13 +18,13 @@ function bar() {
try {
foo()->{bar()} = str_repeat("a", 3);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
?>
--EXPECT--
-Cannot assign string to property Foo::$bbb of type int
-Cannot assign string to property Foo::$bbb of type int
-Cannot assign string to property Foo::$bbb of type int
-Cannot assign string to property Foo::$bbb of type int
-Cannot assign string to property Foo::$bbb of type int
+TypeError: Cannot assign string to property Foo::$bbb of type int
+TypeError: Cannot assign string to property Foo::$bbb of type int
+TypeError: Cannot assign string to property Foo::$bbb of type int
+TypeError: Cannot assign string to property Foo::$bbb of type int
+TypeError: Cannot assign string to property Foo::$bbb of type int
diff --git a/Zend/tests/type_declarations/typed_properties_047.phpt b/Zend/tests/type_declarations/typed_properties_047.phpt
index 5de7b254d99..3e5bd90f832 100644
--- a/Zend/tests/type_declarations/typed_properties_047.phpt
+++ b/Zend/tests/type_declarations/typed_properties_047.phpt
@@ -20,12 +20,12 @@ class Foo {
try {
var_dump($x->foo);
} catch (Throwable $e) {
- echo $e->getMessage()."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$x->foo = "ops";
} catch (Throwable $e) {
- echo $e->getMessage()."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
@@ -36,5 +36,5 @@ class Foo {
NULL
int(5)
NULL
-Typed property Foo::$foo must not be accessed before initialization
-Cannot assign string to property Foo::$foo of type ?int
+Error: Typed property Foo::$foo must not be accessed before initialization
+TypeError: Cannot assign string to property Foo::$foo of type ?int
diff --git a/Zend/tests/type_declarations/typed_properties_051.phpt b/Zend/tests/type_declarations/typed_properties_051.phpt
index 37972c967b1..47103a4efac 100644
--- a/Zend/tests/type_declarations/typed_properties_051.phpt
+++ b/Zend/tests/type_declarations/typed_properties_051.phpt
@@ -19,9 +19,9 @@ class C {
try {
$o->a = new C;
} catch (Throwable $e) {
- echo $e->getMessage()."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
string(4) "okok"
-Cannot assign C to property A::$a of type string
+TypeError: Cannot assign C to property A::$a of type string
diff --git a/Zend/tests/type_declarations/typed_properties_056.phpt b/Zend/tests/type_declarations/typed_properties_056.phpt
index 868594b38ad..b62c7c969ad 100644
--- a/Zend/tests/type_declarations/typed_properties_056.phpt
+++ b/Zend/tests/type_declarations/typed_properties_056.phpt
@@ -13,11 +13,11 @@ class A {
try {
$o->foo += 5;
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($o->foo);
unset($o);
?>
--EXPECT--
-Cannot assign int to property A::$foo of type string
+TypeError: Cannot assign int to property A::$foo of type string
string(3) "100"
diff --git a/Zend/tests/type_declarations/typed_properties_057.phpt b/Zend/tests/type_declarations/typed_properties_057.phpt
index eb565f0c36b..140eaf4b45e 100644
--- a/Zend/tests/type_declarations/typed_properties_057.phpt
+++ b/Zend/tests/type_declarations/typed_properties_057.phpt
@@ -13,19 +13,19 @@ class A {
try {
$x = ++$o->foo;
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($o->foo);
try {
$x = $o->foo++;
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($o->foo);
unset($o);
?>
--EXPECT--
-Cannot assign int to property A::$foo of type string
+TypeError: Cannot assign int to property A::$foo of type string
string(3) "100"
-Cannot assign int to property A::$foo of type string
+TypeError: Cannot assign int to property A::$foo of type string
string(3) "100"
diff --git a/Zend/tests/type_declarations/typed_properties_058.phpt b/Zend/tests/type_declarations/typed_properties_058.phpt
index 47c75037d16..0934d7de0f6 100644
--- a/Zend/tests/type_declarations/typed_properties_058.phpt
+++ b/Zend/tests/type_declarations/typed_properties_058.phpt
@@ -22,11 +22,11 @@ class B {
$o = new B();
var_dump($o->foo);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
?>
--EXPECT--
int(5)
-Cannot assign int to property B::$foo of type string
-Cannot assign int to property B::$foo of type string
+TypeError: Cannot assign int to property B::$foo of type string
+TypeError: Cannot assign int to property B::$foo of type string
diff --git a/Zend/tests/type_declarations/typed_properties_062.phpt b/Zend/tests/type_declarations/typed_properties_062.phpt
index 6e1242e9901..ba12c77a184 100644
--- a/Zend/tests/type_declarations/typed_properties_062.phpt
+++ b/Zend/tests/type_declarations/typed_properties_062.phpt
@@ -18,7 +18,7 @@
try {
$a->_ .= "e50";
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($a->foo);
$a->_--;
@@ -31,30 +31,30 @@
try {
$a->_--;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
--$a->_;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->foo = PHP_INT_MAX;
try {
$a->_++;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
++$a->_;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->_ = 0;
try {
$a->_ = [];
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($a->foo);
$a->_ = 1;
@@ -64,18 +64,18 @@
--EXPECT--
int(2)
int(21)
-Cannot assign string to reference held by property class@anonymous::$foo of type int
+TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int
int(21)
int(20)
int(19)
-Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
integer
-Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
integer
-Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
+TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
integer
-Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
+TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
integer
-Cannot assign array to reference held by property class@anonymous::$foo of type int
+TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int
int(0)
int(1)
diff --git a/Zend/tests/type_declarations/typed_properties_063.phpt b/Zend/tests/type_declarations/typed_properties_063.phpt
index b67e95c24b3..6a299a11afd 100644
--- a/Zend/tests/type_declarations/typed_properties_063.phpt
+++ b/Zend/tests/type_declarations/typed_properties_063.phpt
@@ -17,7 +17,7 @@
try {
$_ .= "e50";
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($a->foo);
$_--;
@@ -30,30 +30,30 @@
try {
$_--;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
--$_;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->foo = PHP_INT_MAX;
try {
$_++;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
++$_;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$_ = 0;
try {
$_ = [];
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($a->foo);
$_ = 1;
@@ -63,18 +63,18 @@
--EXPECT--
int(2)
int(21)
-Cannot assign string to reference held by property class@anonymous::$foo of type int
+TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int
int(21)
int(20)
int(19)
-Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
integer
-Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
integer
-Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
+TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
integer
-Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
+TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
integer
-Cannot assign array to reference held by property class@anonymous::$foo of type int
+TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int
int(0)
int(1)
diff --git a/Zend/tests/type_declarations/typed_properties_064.phpt b/Zend/tests/type_declarations/typed_properties_064.phpt
index dd7b5517a7f..4880707f8f6 100644
--- a/Zend/tests/type_declarations/typed_properties_064.phpt
+++ b/Zend/tests/type_declarations/typed_properties_064.phpt
@@ -17,7 +17,7 @@
try {
$_[0] .= "e50";
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($a->foo);
$_[0]--;
@@ -30,30 +30,30 @@
try {
$_[0]--;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
--$_[0];
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->foo = PHP_INT_MAX;
try {
$_[0]++;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
++$_[0];
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$_[0] = 0;
try {
$_[0] = [];
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($a->foo);
$_[0] = 1;
@@ -63,18 +63,18 @@
--EXPECT--
int(2)
int(21)
-Cannot assign string to reference held by property class@anonymous::$foo of type int
+TypeError: Cannot assign string to reference held by property class@anonymous::$foo of type int
int(21)
int(20)
int(19)
-Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
integer
-Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
integer
-Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
+TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
integer
-Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
+TypeError: Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
integer
-Cannot assign array to reference held by property class@anonymous::$foo of type int
+TypeError: Cannot assign array to reference held by property class@anonymous::$foo of type int
int(0)
int(1)
diff --git a/Zend/tests/type_declarations/typed_properties_065.phpt b/Zend/tests/type_declarations/typed_properties_065.phpt
index a3a536da07e..a4d0aa4c0c0 100644
--- a/Zend/tests/type_declarations/typed_properties_065.phpt
+++ b/Zend/tests/type_declarations/typed_properties_065.phpt
@@ -31,24 +31,24 @@ function offsetUnset($o): void { print "offsetUnset() ?!?"; }
try {
$a[0]--;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
--$a[0];
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->foo = PHP_INT_MAX;
try {
$a[0]++;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
++$a[0];
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
?>
@@ -61,11 +61,11 @@ function offsetUnset($o): void { print "offsetUnset() ?!?"; }
int(1)
int(0)
int(-1)
-Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
integer
-Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
integer
-Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
+TypeError: Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
integer
-Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
+TypeError: Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
integer
diff --git a/Zend/tests/type_declarations/typed_properties_068.phpt b/Zend/tests/type_declarations/typed_properties_068.phpt
index 38597559cf0..f6c810b7c0f 100644
--- a/Zend/tests/type_declarations/typed_properties_068.phpt
+++ b/Zend/tests/type_declarations/typed_properties_068.phpt
@@ -28,12 +28,12 @@ class Foo {
try {
$i = null;
-} catch (TypeError $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($i, Foo::$i);
try {
Foo::$i = null;
-} catch (TypeError $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($i, Foo::$i);
Foo::$s = &ref(5);
@@ -44,17 +44,17 @@ class Foo {
try {
Foo::$i = &ref("x");
-} catch (TypeError $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump(Foo::$i, ref());
try {
Foo::$i = &Foo::$s;
-} catch (TypeError $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump(Foo::$i, Foo::$s);
try {
Foo::$s = &Foo::$i;
-} catch (TypeError $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump(Foo::$i, Foo::$s);
?>
@@ -66,22 +66,22 @@ class Foo {
int(3)
int(4)
int(4)
-Cannot assign null to reference held by property Foo::$i of type int
+TypeError: Cannot assign null to reference held by property Foo::$i of type int
int(4)
int(4)
-Cannot assign null to property Foo::$i of type int
+TypeError: Cannot assign null to property Foo::$i of type int
int(4)
int(4)
string(1) "5"
string(1) "5"
int(0)
int(0)
-Cannot assign string to property Foo::$i of type int
+TypeError: Cannot assign string to property Foo::$i of type int
int(0)
string(1) "x"
-Reference with value of type string held by property Foo::$s of type string is not compatible with property Foo::$i of type int
+TypeError: Reference with value of type string held by property Foo::$s of type string is not compatible with property Foo::$i of type int
int(0)
string(1) "5"
-Reference with value of type int held by property Foo::$i of type int is not compatible with property Foo::$s of type string
+TypeError: Reference with value of type int held by property Foo::$i of type int is not compatible with property Foo::$s of type string
int(0)
string(1) "5"
diff --git a/Zend/tests/type_declarations/typed_properties_069.phpt b/Zend/tests/type_declarations/typed_properties_069.phpt
index 7d84407102d..63c1d91e9ff 100644
--- a/Zend/tests/type_declarations/typed_properties_069.phpt
+++ b/Zend/tests/type_declarations/typed_properties_069.phpt
@@ -14,14 +14,14 @@ class Foo {
try {
Foo::$i = &nonNumericStringRef();
-} catch (TypeError $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
try {
var_dump(Foo::$i);
-} catch (Error $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump(nonNumericStringRef());
?>
--EXPECT--
-Cannot assign string to property Foo::$i of type int
-Typed static property Foo::$i must not be accessed before initialization
+TypeError: Cannot assign string to property Foo::$i of type int
+Error: Typed static property Foo::$i must not be accessed before initialization
string(1) "x"
diff --git a/Zend/tests/type_declarations/typed_properties_070.phpt b/Zend/tests/type_declarations/typed_properties_070.phpt
index d039fca3b14..bc3d33dd1bf 100644
--- a/Zend/tests/type_declarations/typed_properties_070.phpt
+++ b/Zend/tests/type_declarations/typed_properties_070.phpt
@@ -29,12 +29,12 @@ class Foo {
try {
Foo::$i += PHP_INT_MAX;
-} catch (TypeError $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump(Foo::$i);
try {
Foo::$i .= PHP_INT_MAX;
-} catch (TypeError $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump(Foo::$i);
?>
@@ -43,7 +43,7 @@ class Foo {
string(2) "13"
string(2) "12"
int(1)
-Cannot assign float to property Foo::$i of type int
+TypeError: Cannot assign float to property Foo::$i of type int
int(1)
-Cannot assign string to property Foo::$i of type int
+TypeError: Cannot assign string to property Foo::$i of type int
int(1)
diff --git a/Zend/tests/type_declarations/typed_properties_074.phpt b/Zend/tests/type_declarations/typed_properties_074.phpt
index 3f98e72f736..ce99618fb1c 100644
--- a/Zend/tests/type_declarations/typed_properties_074.phpt
+++ b/Zend/tests/type_declarations/typed_properties_074.phpt
@@ -18,7 +18,7 @@ public function &__get($name) {
var_dump($test);
try {
var_dump($test->val);
-} catch (TypeError $e) { print $e->getMessage()."\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($test);
$test->prop = "y";
@@ -32,7 +32,7 @@ public function &__get($name) {
["val"]=>
uninitialized(int)
}
-Value of type string returned from Test::__get() must be compatible with unset property Test::$val of type int
+TypeError: Value of type string returned from Test::__get() must be compatible with unset property Test::$val of type int
object(Test)#1 (1) {
["prop"]=>
&string(1) "x"
diff --git a/Zend/tests/type_declarations/typed_properties_075.phpt b/Zend/tests/type_declarations/typed_properties_075.phpt
index 42e74ebce44..7e44798ef3e 100644
--- a/Zend/tests/type_declarations/typed_properties_075.phpt
+++ b/Zend/tests/type_declarations/typed_properties_075.phpt
@@ -11,43 +11,43 @@ class Foo {
try {
Foo::$bar++;
-} catch(TypeError $t) {
- var_dump($t->getMessage());
+} catch(Throwable $t) {
+ echo $t::class, ': ', $t->getMessage(), "\n";
}
var_dump(Foo::$bar);
try {
Foo::$bar += 1;
-} catch(TypeError $t) {
- var_dump($t->getMessage());
+} catch(Throwable $t) {
+ echo $t::class, ': ', $t->getMessage(), "\n";
}
var_dump(Foo::$bar);
try {
++Foo::$bar;
-} catch(TypeError $t) {
- var_dump($t->getMessage());
+} catch(Throwable $t) {
+ echo $t::class, ': ', $t->getMessage(), "\n";
}
var_dump(Foo::$bar);
try {
Foo::$bar = Foo::$bar + 1;
-} catch(TypeError $t) {
- var_dump($t->getMessage());
+} catch(Throwable $t) {
+ echo $t::class, ': ', $t->getMessage(), "\n";
}
var_dump(Foo::$bar);
?>
--EXPECT--
-string(70) "Cannot increment property Foo::$bar of type int past its maximal value"
+TypeError: Cannot increment property Foo::$bar of type int past its maximal value
int(9223372036854775807)
-string(53) "Cannot assign float to property Foo::$bar of type int"
+TypeError: Cannot assign float to property Foo::$bar of type int
int(9223372036854775807)
-string(70) "Cannot increment property Foo::$bar of type int past its maximal value"
+TypeError: Cannot increment property Foo::$bar of type int past its maximal value
int(9223372036854775807)
-string(53) "Cannot assign float to property Foo::$bar of type int"
+TypeError: Cannot assign float to property Foo::$bar of type int
int(9223372036854775807)
diff --git a/Zend/tests/type_declarations/typed_properties_076.phpt b/Zend/tests/type_declarations/typed_properties_076.phpt
index b0d0bfedf80..9aab4a5b37f 100644
--- a/Zend/tests/type_declarations/typed_properties_076.phpt
+++ b/Zend/tests/type_declarations/typed_properties_076.phpt
@@ -36,14 +36,14 @@ function valid(Test $test, string $prop1, string $prop2, $value) {
try {
$test->$prop2 = $value;
$test->$prop1 =& $test->$prop2;
- } catch (TypeError $e) {
- echo "Valid assignment $prop1 =& $prop2 threw {$e->getMessage()}\n";
+ } catch (Throwable $e) {
+ echo "Valid assignment $prop1 =& $prop2 ", $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->$prop1 = $value;
$test->$prop2 =& $test->$prop1;
- } catch (TypeError $e) {
- echo "Valid assignment $prop2 =& $prop1 threw {$e->getMessage()}\n";
+ } catch (Throwable $e) {
+ echo "Valid assignment $prop2 =& $prop1 ", $e::class, ': ', $e->getMessage(), "\n";
}
}
diff --git a/Zend/tests/type_declarations/typed_properties_078.phpt b/Zend/tests/type_declarations/typed_properties_078.phpt
index 07e9384b6f5..346516b4b22 100644
--- a/Zend/tests/type_declarations/typed_properties_078.phpt
+++ b/Zend/tests/type_declarations/typed_properties_078.phpt
@@ -16,7 +16,7 @@
try {
$a->t = &$ref;
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($ref);
$a->it = [1]; // type is still assignable
@@ -24,7 +24,7 @@
try {
$ref = new ArrayIterator();
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($ref instanceof ArrayIterator);
unset($a->a);
@@ -35,7 +35,7 @@
try {
$ref = [];
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($ref instanceof ArrayIterator);
$ref = new ArrayIterator();
@@ -45,15 +45,15 @@
--EXPECT--
array(0) {
}
-string(72) "Cannot assign array to property class@anonymous::$t of type ?Traversable"
+TypeError: Cannot assign array to property class@anonymous::$t of type ?Traversable
array(0) {
}
array(1) {
[0]=>
int(1)
}
-string(92) "Cannot assign ArrayIterator to reference held by property class@anonymous::$a of type ?array"
+TypeError: Cannot assign ArrayIterator to reference held by property class@anonymous::$a of type ?array
bool(false)
-string(90) "Cannot assign array to reference held by property class@anonymous::$t of type ?Traversable"
+TypeError: Cannot assign array to reference held by property class@anonymous::$t of type ?Traversable
bool(false)
bool(true)
diff --git a/Zend/tests/type_declarations/typed_properties_079.phpt b/Zend/tests/type_declarations/typed_properties_079.phpt
index d189cec6d4c..17b569a2738 100644
--- a/Zend/tests/type_declarations/typed_properties_079.phpt
+++ b/Zend/tests/type_declarations/typed_properties_079.phpt
@@ -12,7 +12,7 @@ class A {
try {
A::$it = new ArrayIterator();
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump(A::$it);
A::$a = &$a;
@@ -21,13 +21,13 @@ class A {
try {
$a = 1;
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($a);
?>
--EXPECT--
-string(78) "Cannot assign ArrayIterator to reference held by property A::$a of type ?array"
+TypeError: Cannot assign ArrayIterator to reference held by property A::$a of type ?array
array(0) {
}
-string(68) "Cannot assign int to reference held by property A::$a of type ?array"
+TypeError: Cannot assign int to reference held by property A::$a of type ?array
NULL
diff --git a/Zend/tests/type_declarations/typed_properties_080.phpt b/Zend/tests/type_declarations/typed_properties_080.phpt
index 58a17a1a965..ec8a69654d2 100644
--- a/Zend/tests/type_declarations/typed_properties_080.phpt
+++ b/Zend/tests/type_declarations/typed_properties_080.phpt
@@ -11,18 +11,18 @@ class Test {
static function run() {
try {
self::$a;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
self::$b;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
self::$c;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
@@ -31,6 +31,6 @@ static function run() {
?>
--EXPECT--
-Typed static property Test::$a must not be accessed before initialization
-Typed static property Test::$b must not be accessed before initialization
-Typed static property Test::$c must not be accessed before initialization
+Error: Typed static property Test::$a must not be accessed before initialization
+Error: Typed static property Test::$b must not be accessed before initialization
+Error: Typed static property Test::$c must not be accessed before initialization
diff --git a/Zend/tests/type_declarations/typed_properties_081.phpt b/Zend/tests/type_declarations/typed_properties_081.phpt
index f6d2114c6f2..c5120e8822e 100644
--- a/Zend/tests/type_declarations/typed_properties_081.phpt
+++ b/Zend/tests/type_declarations/typed_properties_081.phpt
@@ -13,10 +13,10 @@ class Test {
unset($test);
try {
$x = "foo";
-} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($test2->x);
?>
--EXPECT--
-Cannot assign string to reference held by property Test::$x of type int
+TypeError: Cannot assign string to reference held by property Test::$x of type int
int(42)
diff --git a/Zend/tests/type_declarations/typed_properties_082.phpt b/Zend/tests/type_declarations/typed_properties_082.phpt
index d212f1852cb..24cbfe7510d 100644
--- a/Zend/tests/type_declarations/typed_properties_082.phpt
+++ b/Zend/tests/type_declarations/typed_properties_082.phpt
@@ -14,7 +14,7 @@ class Test2 extends Test {
$x =& Test::$x;
try {
$x = "foo";
-} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($x, Test::$x);
Test::$x =& Test2::$y; // remove the typed ref from $x
@@ -23,7 +23,7 @@ class Test2 extends Test {
?>
--EXPECT--
-Cannot assign string to reference held by property Test::$x of type int
+TypeError: Cannot assign string to reference held by property Test::$x of type int
int(0)
int(0)
string(3) "foo"
diff --git a/Zend/tests/type_declarations/typed_properties_083.phpt b/Zend/tests/type_declarations/typed_properties_083.phpt
index f67eec302a4..57b3cdea8ba 100644
--- a/Zend/tests/type_declarations/typed_properties_083.phpt
+++ b/Zend/tests/type_declarations/typed_properties_083.phpt
@@ -17,15 +17,15 @@ class Foo {
try {
$a->p[] = "test";
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
try { // must be uninit
var_dump($a->p); // WRONG!
-} catch (Error $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
$a->p = null;
try {
$a->p[] = "test";
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($a->p);
Foo::$a["bar"] = 2;
@@ -33,10 +33,10 @@ class Foo {
try {
Foo::$s["baz"][] = "baz";
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
try { // must be uninit
var_dump(Foo::$s);
-} catch (Error $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
Foo::$a = null;
$ref = &Foo::$a;
@@ -46,12 +46,12 @@ class Foo {
$ref = &$a->p;
try {
$ref[] = "bar";
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($ref);
try {
$ref["baz"][] = "bar"; // indirect assign
-} catch (TypeError $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
var_dump($ref);
?>
@@ -60,21 +60,21 @@ class Foo {
[0]=>
int(1)
}
-string(71) "Cannot auto-initialize an array inside property Foo::$p of type ?string"
-string(65) "Typed property Foo::$p must not be accessed before initialization"
-string(71) "Cannot auto-initialize an array inside property Foo::$p of type ?string"
+TypeError: Cannot auto-initialize an array inside property Foo::$p of type ?string
+Error: Typed property Foo::$p must not be accessed before initialization
+TypeError: Cannot auto-initialize an array inside property Foo::$p of type ?string
NULL
array(1) {
["bar"]=>
int(2)
}
-string(71) "Cannot auto-initialize an array inside property Foo::$s of type ?string"
-string(72) "Typed static property Foo::$s must not be accessed before initialization"
+TypeError: Cannot auto-initialize an array inside property Foo::$s of type ?string
+Error: Typed static property Foo::$s must not be accessed before initialization
array(1) {
[0]=>
int(3)
}
-string(91) "Cannot auto-initialize an array inside a reference held by property Foo::$p of type ?string"
+TypeError: Cannot auto-initialize an array inside a reference held by property Foo::$p of type ?string
NULL
-string(91) "Cannot auto-initialize an array inside a reference held by property Foo::$p of type ?string"
+TypeError: Cannot auto-initialize an array inside a reference held by property Foo::$p of type ?string
NULL
diff --git a/Zend/tests/type_declarations/typed_properties_093.phpt b/Zend/tests/type_declarations/typed_properties_093.phpt
index 1f4bf4cb8ca..9881c4c1726 100644
--- a/Zend/tests/type_declarations/typed_properties_093.phpt
+++ b/Zend/tests/type_declarations/typed_properties_093.phpt
@@ -17,14 +17,14 @@ public function __toString() {
$ref = "foobar";
try {
$test->$name =& $ref;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test);
?>
--EXPECT--
-Cannot assign string to property Test::$prop of type int
+TypeError: Cannot assign string to property Test::$prop of type int
object(Test)#2 (0) {
["prop"]=>
uninitialized(int)
diff --git a/Zend/tests/type_declarations/typed_properties_095.phpt b/Zend/tests/type_declarations/typed_properties_095.phpt
index 4d8e5168e15..8c2858f3023 100644
--- a/Zend/tests/type_declarations/typed_properties_095.phpt
+++ b/Zend/tests/type_declarations/typed_properties_095.phpt
@@ -12,15 +12,15 @@
var_dump($obj->intProp);
try {
$obj->intProp = "foobar";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$obj->intProp = 456;
try {
$obj->classProp = $obj;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$obj->classProp = new stdClass;
var_dump($obj);
@@ -34,15 +34,15 @@ class Test extends _ZendTestClass {
var_dump($obj->intProp);
try {
$obj->intProp = "foobar";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$obj->intProp = 456;
try {
$obj->classProp = $obj;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$obj->classProp = new stdClass;
var_dump($obj);
@@ -52,8 +52,8 @@ class Test extends _ZendTestClass {
var_dump(_ZendTestClass::$staticIntProp);
try {
_ZendTestClass::$staticIntProp = "foobar";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
_ZendTestClass::$staticIntProp = 456;
var_dump(_ZendTestClass::$staticIntProp);
@@ -61,8 +61,8 @@ class Test extends _ZendTestClass {
?>
--EXPECT--
int(123)
-Cannot assign string to property _ZendTestClass::$intProp of type int
-Cannot assign _ZendTestClass to property _ZendTestClass::$classProp of type ?stdClass
+TypeError: Cannot assign string to property _ZendTestClass::$intProp of type int
+TypeError: Cannot assign _ZendTestClass to property _ZendTestClass::$classProp of type ?stdClass
object(_ZendTestClass)#1 (3) {
["intProp"]=>
int(456)
@@ -81,8 +81,8 @@ class Test extends _ZendTestClass {
uninitialized(Iterator|(Traversable&Countable))
}
int(123)
-Cannot assign string to property _ZendTestClass::$intProp of type int
-Cannot assign Test to property _ZendTestClass::$classProp of type ?stdClass
+TypeError: Cannot assign string to property _ZendTestClass::$intProp of type int
+TypeError: Cannot assign Test to property _ZendTestClass::$classProp of type ?stdClass
object(Test)#4 (3) {
["intProp"]=>
int(456)
@@ -101,5 +101,5 @@ class Test extends _ZendTestClass {
uninitialized(Iterator|(Traversable&Countable))
}
int(123)
-Cannot assign string to property _ZendTestClass::$staticIntProp of type int
+TypeError: Cannot assign string to property _ZendTestClass::$staticIntProp of type int
int(456)
diff --git a/Zend/tests/type_declarations/typed_properties_096.phpt b/Zend/tests/type_declarations/typed_properties_096.phpt
index 83f086d345a..bc7cd2dfa15 100644
--- a/Zend/tests/type_declarations/typed_properties_096.phpt
+++ b/Zend/tests/type_declarations/typed_properties_096.phpt
@@ -13,8 +13,8 @@ class Test1 {
$ref =& $test->prop2;
try {
$test->prop =& $ref;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test);
@@ -31,7 +31,7 @@ class Test2 {
?>
--EXPECT--
-Cannot assign int to property Test1::$prop of type Foobar
+TypeError: Cannot assign int to property Test1::$prop of type Foobar
object(Test1)#1 (1) {
["prop"]=>
uninitialized(Foobar)
diff --git a/Zend/tests/type_declarations/typed_properties_097.phpt b/Zend/tests/type_declarations/typed_properties_097.phpt
index 6697f2ad275..13989752796 100644
--- a/Zend/tests/type_declarations/typed_properties_097.phpt
+++ b/Zend/tests/type_declarations/typed_properties_097.phpt
@@ -14,28 +14,28 @@ class Test {
$test->foo = PHP_INT_MIN;
try {
--$test->foo;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->foo);
try {
$test->foo--;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->foo);
$test->foo = PHP_INT_MAX;
try {
++$test->foo;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->foo);
try {
$test->foo++;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->foo);
@@ -45,46 +45,46 @@ class Test {
$test->foo = PHP_INT_MIN;
try {
--$test->foo;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->foo);
try {
$test->foo--;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->foo);
$test->foo = PHP_INT_MAX;
try {
++$test->foo;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->foo);
try {
$test->foo++;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->foo);
?>
--EXPECT--
-Cannot decrement property Test::$foo of type int past its minimal value
+TypeError: Cannot decrement property Test::$foo of type int past its minimal value
int(-9223372036854775808)
-Cannot decrement property Test::$foo of type int past its minimal value
+TypeError: Cannot decrement property Test::$foo of type int past its minimal value
int(-9223372036854775808)
-Cannot increment property Test::$foo of type int past its maximal value
+TypeError: Cannot increment property Test::$foo of type int past its maximal value
int(9223372036854775807)
-Cannot increment property Test::$foo of type int past its maximal value
+TypeError: Cannot increment property Test::$foo of type int past its maximal value
int(9223372036854775807)
-Cannot decrement a reference held by property Test::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property Test::$foo of type int past its minimal value
int(-9223372036854775808)
-Cannot decrement a reference held by property Test::$foo of type int past its minimal value
+TypeError: Cannot decrement a reference held by property Test::$foo of type int past its minimal value
int(-9223372036854775808)
-Cannot increment a reference held by property Test::$foo of type int past its maximal value
+TypeError: Cannot increment a reference held by property Test::$foo of type int past its maximal value
+int(9223372036854775807)
+TypeError: Cannot increment a reference held by property Test::$foo of type int past its maximal value
int(9223372036854775807)
-Cannot increment a reference held by property Test::$foo of type int past its maximal value
-int(9223372036854775807)
\ No newline at end of file
diff --git a/Zend/tests/type_declarations/typed_properties_102.phpt b/Zend/tests/type_declarations/typed_properties_102.phpt
index 83f3c26186f..82271d27589 100644
--- a/Zend/tests/type_declarations/typed_properties_102.phpt
+++ b/Zend/tests/type_declarations/typed_properties_102.phpt
@@ -11,12 +11,12 @@ class Test {
Test::$prop =& Test::$intProp;
try {
Test::$prop .= "foobar";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(Test::$prop, Test::$intProp);
?>
--EXPECT--
-Cannot assign string to reference held by property Test::$intProp of type int
+TypeError: Cannot assign string to reference held by property Test::$intProp of type int
int(123)
int(123)
diff --git a/Zend/tests/type_declarations/typed_properties_105.phpt b/Zend/tests/type_declarations/typed_properties_105.phpt
index 747ff9f1905..98fca7ce7d9 100644
--- a/Zend/tests/type_declarations/typed_properties_105.phpt
+++ b/Zend/tests/type_declarations/typed_properties_105.phpt
@@ -17,4 +17,3 @@ class A {
array(0) {
}
bool(false)
-
diff --git a/Zend/tests/type_declarations/typed_properties_106.phpt b/Zend/tests/type_declarations/typed_properties_106.phpt
index 344cfa5349e..fa114c5db00 100644
--- a/Zend/tests/type_declarations/typed_properties_106.phpt
+++ b/Zend/tests/type_declarations/typed_properties_106.phpt
@@ -9,18 +9,18 @@ class Test {
$ref =& $obj->prop;
try {
$ref = [1];
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$ary = [1];
$ref = $ary;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($ref);
?>
--EXPECT--
-Cannot assign array to reference held by property Test::$prop of type ?Type
-Cannot assign array to reference held by property Test::$prop of type ?Type
+TypeError: Cannot assign array to reference held by property Test::$prop of type ?Type
+TypeError: Cannot assign array to reference held by property Test::$prop of type ?Type
NULL
diff --git a/Zend/tests/type_declarations/typed_properties_110.phpt b/Zend/tests/type_declarations/typed_properties_110.phpt
index 6a108b4529c..0a7608d244a 100644
--- a/Zend/tests/type_declarations/typed_properties_110.phpt
+++ b/Zend/tests/type_declarations/typed_properties_110.phpt
@@ -11,10 +11,10 @@ class Foo {
try {
$foo->value = 1;
-} catch (\TypeError $e) {
- echo $e->getMessage();
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign int to property Foo::$value of type null
+TypeError: Cannot assign int to property Foo::$value of type null
diff --git a/Zend/tests/type_declarations/typed_properties_111.phpt b/Zend/tests/type_declarations/typed_properties_111.phpt
index 20236e8a19b..a5a1b664d0b 100644
--- a/Zend/tests/type_declarations/typed_properties_111.phpt
+++ b/Zend/tests/type_declarations/typed_properties_111.phpt
@@ -11,10 +11,10 @@ class Foo {
try {
$foo->value = true;
-} catch (\TypeError $e) {
- echo $e->getMessage();
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign true to property Foo::$value of type false
+TypeError: Cannot assign true to property Foo::$value of type false
diff --git a/Zend/tests/type_declarations/typed_properties_112.phpt b/Zend/tests/type_declarations/typed_properties_112.phpt
index 8b1157759fe..4d125295649 100644
--- a/Zend/tests/type_declarations/typed_properties_112.phpt
+++ b/Zend/tests/type_declarations/typed_properties_112.phpt
@@ -10,10 +10,10 @@ class Foo {
try {
$foo->value = false;
-} catch (\TypeError $e) {
- echo $e->getMessage();
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign false to property Foo::$value of type true
+TypeError: Cannot assign false to property Foo::$value of type true
diff --git a/Zend/tests/type_declarations/typed_properties_114.phpt b/Zend/tests/type_declarations/typed_properties_114.phpt
index 5f3093dd330..1d4b3018462 100644
--- a/Zend/tests/type_declarations/typed_properties_114.phpt
+++ b/Zend/tests/type_declarations/typed_properties_114.phpt
@@ -17,14 +17,14 @@ function getIterator(): Traversable {
try {
$v = [];
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
foreach ($obj as $k => &$v) {
try {
$v = [];
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -32,10 +32,10 @@ function getIterator(): Traversable {
?>
--EXPECTF--
Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
-Cannot assign array to reference held by property A::$foo of type string
+TypeError: Cannot assign array to reference held by property A::$foo of type string
Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
-Cannot assign array to reference held by property A::$foo of type string
+TypeError: Cannot assign array to reference held by property A::$foo of type string
object(A)#1 (1) {
["foo"]=>
&string(3) "bar"
diff --git a/Zend/tests/type_declarations/typed_properties_115.phpt b/Zend/tests/type_declarations/typed_properties_115.phpt
index 6347ee0c35d..d929fb60dc8 100644
--- a/Zend/tests/type_declarations/typed_properties_115.phpt
+++ b/Zend/tests/type_declarations/typed_properties_115.phpt
@@ -17,14 +17,14 @@ function getIterator(): Traversable {
try {
foreach ($obj as $k => &$v) {}
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($obj);
?>
--EXPECTF--
Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
-Cannot acquire reference to readonly property A::$foo
+Error: Cannot acquire reference to readonly property A::$foo
object(A)#1 (1) {
["foo"]=>
string(3) "bar"
diff --git a/Zend/tests/type_declarations/typed_properties_cache_slot_opt.phpt b/Zend/tests/type_declarations/typed_properties_cache_slot_opt.phpt
index 72cff1058f2..3f8cf1748ef 100644
--- a/Zend/tests/type_declarations/typed_properties_cache_slot_opt.phpt
+++ b/Zend/tests/type_declarations/typed_properties_cache_slot_opt.phpt
@@ -11,8 +11,8 @@ public function method() {
$this->prop = 1;
try {
$this->prop = "foobar";
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($this->prop);
}
@@ -24,7 +24,7 @@ public function method() {
?>
--EXPECT--
-Cannot assign string to property Test::$prop of type int
+TypeError: Cannot assign string to property Test::$prop of type int
int(1)
-Cannot assign string to property Test::$prop of type int
+TypeError: Cannot assign string to property Test::$prop of type int
int(1)
diff --git a/Zend/tests/type_declarations/typed_properties_class_loading.phpt b/Zend/tests/type_declarations/typed_properties_class_loading.phpt
index a81bc5b4fe0..28f4518107f 100644
--- a/Zend/tests/type_declarations/typed_properties_class_loading.phpt
+++ b/Zend/tests/type_declarations/typed_properties_class_loading.phpt
@@ -15,8 +15,8 @@ class Test {
$test = new Test;
try {
$test->propX = new stdClass;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
if (true) {
@@ -30,8 +30,8 @@ class X {}
$r =& $test->propY;
try {
$test->propY = new stdClass;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
if (true) {
@@ -43,9 +43,9 @@ class Y {}
?>
--EXPECT--
-Cannot assign stdClass to property Test::$propX of type X
+TypeError: Cannot assign stdClass to property Test::$propX of type X
object(X)#3 (0) {
}
-Cannot assign stdClass to property Test::$propY of type ?Y
+TypeError: Cannot assign stdClass to property Test::$propY of type ?Y
object(Y)#4 (0) {
}
diff --git a/Zend/tests/type_declarations/typed_properties_failed_assign_is_not_init.phpt b/Zend/tests/type_declarations/typed_properties_failed_assign_is_not_init.phpt
index 5754591ce7d..7c958137e40 100644
--- a/Zend/tests/type_declarations/typed_properties_failed_assign_is_not_init.phpt
+++ b/Zend/tests/type_declarations/typed_properties_failed_assign_is_not_init.phpt
@@ -15,22 +15,22 @@ public function __get($name) {
$test = new Test;
try {
$test->prop;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop = "foo";
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Typed property Test::$prop must not be accessed before initialization
-Cannot assign string to property Test::$prop of type int
-Typed property Test::$prop must not be accessed before initialization
+Error: Typed property Test::$prop must not be accessed before initialization
+TypeError: Cannot assign string to property Test::$prop of type int
+Error: Typed property Test::$prop must not be accessed before initialization
diff --git a/Zend/tests/type_declarations/typed_properties_magic_set.phpt b/Zend/tests/type_declarations/typed_properties_magic_set.phpt
index 70a7d4fe6f0..1e2cf13f2bb 100644
--- a/Zend/tests/type_declarations/typed_properties_magic_set.phpt
+++ b/Zend/tests/type_declarations/typed_properties_magic_set.phpt
@@ -24,8 +24,8 @@ public function __unset($name) {
$test = new Test;
try {
var_dump($test->foo);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(isset($test->foo));
$test->foo = 42;
@@ -61,7 +61,7 @@ class Test2 extends Test {
?>
--EXPECT--
-Typed property Test::$foo must not be accessed before initialization
+Error: Typed property Test::$foo must not be accessed before initialization
bool(false)
int(42)
__set foo = 42
diff --git a/Zend/tests/type_declarations/union_types/anonymous_class.phpt b/Zend/tests/type_declarations/union_types/anonymous_class.phpt
index 1e009f22b00..1ffec32de05 100644
--- a/Zend/tests/type_declarations/union_types/anonymous_class.phpt
+++ b/Zend/tests/type_declarations/union_types/anonymous_class.phpt
@@ -16,15 +16,15 @@ public function test(): self|string
try {
$a->testParam(null);
} catch (\Throwable $e) {
- echo $e->getMessage()."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$a->test();
} catch (\Throwable $e) {
- echo $e->getMessage()."\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-class@anonymous(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d
-class@anonymous::test(): Return value must be of type class@anonymous|string, stdClass returned
+TypeError: class@anonymous(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d
+TypeError: class@anonymous::test(): Return value must be of type class@anonymous|string, stdClass returned
diff --git a/Zend/tests/type_declarations/union_types/incdec_prop.phpt b/Zend/tests/type_declarations/union_types/incdec_prop.phpt
index 7b61fc9fe60..62beef9befe 100644
--- a/Zend/tests/type_declarations/union_types/incdec_prop.phpt
+++ b/Zend/tests/type_declarations/union_types/incdec_prop.phpt
@@ -55,61 +55,61 @@ class Test {
try {
$test->prop2 = PHP_INT_MAX;
$x = $test->prop2++;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop2 = PHP_INT_MAX;
$x = ++$test->prop2;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop2 = PHP_INT_MIN;
$x = $test->prop2--;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop2 = PHP_INT_MIN;
$x = --$test->prop2;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop2 = PHP_INT_MAX;
$r =& $test->prop2;
$x = $test->prop2++;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop2 = PHP_INT_MAX;
$r =& $test->prop2;
$x = ++$test->prop2;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop2 = PHP_INT_MIN;
$r =& $test->prop2;
$x = $test->prop2--;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop2 = PHP_INT_MIN;
$r =& $test->prop2;
$x = --$test->prop2;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -122,11 +122,11 @@ class Test {
bool(true)
bool(true)
bool(true)
-Cannot increment property Test::$prop2 of type int|bool past its maximal value
-Cannot increment property Test::$prop2 of type int|bool past its maximal value
-Cannot decrement property Test::$prop2 of type int|bool past its minimal value
-Cannot decrement property Test::$prop2 of type int|bool past its minimal value
-Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value
-Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value
-Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value
-Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value
+TypeError: Cannot increment property Test::$prop2 of type int|bool past its maximal value
+TypeError: Cannot increment property Test::$prop2 of type int|bool past its maximal value
+TypeError: Cannot decrement property Test::$prop2 of type int|bool past its minimal value
+TypeError: Cannot decrement property Test::$prop2 of type int|bool past its minimal value
+TypeError: Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value
+TypeError: Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value
+TypeError: Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value
+TypeError: Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value
diff --git a/Zend/tests/type_declarations/union_types/inheritance_internal.phpt b/Zend/tests/type_declarations/union_types/inheritance_internal.phpt
index 9841e34ff90..81aa4079bc8 100644
--- a/Zend/tests/type_declarations/union_types/inheritance_internal.phpt
+++ b/Zend/tests/type_declarations/union_types/inheritance_internal.phpt
@@ -12,8 +12,8 @@ class C extends _ZendTestClass {}
$obj->classUnionProp = new ArrayIterator;
try {
$obj->classUnionProp = new DateTime;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$obj = new C;
@@ -21,11 +21,11 @@ class C extends _ZendTestClass {}
$obj->classUnionProp = new ArrayIterator;
try {
$obj->classUnionProp = new DateTime;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null
-Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null
+TypeError: Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null
+TypeError: Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null
diff --git a/Zend/tests/type_declarations/union_types/multiple_classes.phpt b/Zend/tests/type_declarations/union_types/multiple_classes.phpt
index b45fc02d83f..d507550db43 100644
--- a/Zend/tests/type_declarations/union_types/multiple_classes.phpt
+++ b/Zend/tests/type_declarations/union_types/multiple_classes.phpt
@@ -27,14 +27,14 @@ public function method(X|Y|Z|int $arg): X|Y|Z|int {
try {
$test->prop = new stdClass;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->method(new stdClass);
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
if (true) {
@@ -67,8 +67,8 @@ class Y {}
int(42)
int(42)
int(42)
-Cannot assign stdClass to property Test::$prop of type X|Y|Z|int
-Test::method(): Argument #1 ($arg) must be of type X|Y|Z|int, stdClass given, called in %s on line %d
+TypeError: Cannot assign stdClass to property Test::$prop of type X|Y|Z|int
+TypeError: Test::method(): Argument #1 ($arg) must be of type X|Y|Z|int, stdClass given, called in %s on line %d
object(X)#4 (0) {
}
object(X)#6 (0) {
diff --git a/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt b/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt
index a8db8fca9cd..ac2b2da19f0 100644
--- a/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt
+++ b/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt
@@ -16,16 +16,16 @@ class Test {
$v = 42;
try {
$r = $v;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($r, $v);
$v = 42.0;
try {
$r = $v;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($r, $v);
@@ -34,8 +34,8 @@ class Test {
$test->x = 42;
try {
$test->y =& $test->x;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
unset($test->x, $test->y);
@@ -43,17 +43,17 @@ class Test {
$test->y = 42.0;
try {
$test->x =& $test->y;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign int to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion
+TypeError: Cannot assign int to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion
string(6) "foobar"
int(42)
-Cannot assign float to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion
+TypeError: Cannot assign float to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion
string(6) "foobar"
float(42)
-Reference with value of type int held by property Test::$x of type string|int is not compatible with property Test::$y of type string|float
-Reference with value of type float held by property Test::$y of type string|float is not compatible with property Test::$x of type string|int
+TypeError: Reference with value of type int held by property Test::$x of type string|int is not compatible with property Test::$y of type string|float
+TypeError: Reference with value of type float held by property Test::$y of type string|float is not compatible with property Test::$x of type string|int
diff --git a/Zend/tests/type_declarations/variance/loading_exception1.phpt b/Zend/tests/type_declarations/variance/loading_exception1.phpt
index ea5be4e56f0..e043136b161 100644
--- a/Zend/tests/type_declarations/variance/loading_exception1.phpt
+++ b/Zend/tests/type_declarations/variance/loading_exception1.phpt
@@ -12,8 +12,8 @@
try {
class B extends A {
}
- } catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -33,14 +33,14 @@ public function test(): B {}
try {
class B extends A implements I {
}
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-Class A does not exist
-Class A does not exist
+Exception: Class A does not exist
+Exception: Class A does not exist
Fatal error: During inheritance of B with variance dependencies: Uncaught Exception: Class A does not exist in %s:%d
Stack trace:
diff --git a/Zend/tests/type_declarations/variance/loading_exception2.phpt b/Zend/tests/type_declarations/variance/loading_exception2.phpt
index db9c6b27658..f2b5500f2b3 100644
--- a/Zend/tests/type_declarations/variance/loading_exception2.phpt
+++ b/Zend/tests/type_declarations/variance/loading_exception2.phpt
@@ -14,8 +14,8 @@ class A {}
try {
class B extends A implements I {
}
- } catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -35,14 +35,14 @@ public function test(): B {}
try {
class B extends A implements I, J {
}
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-Class I does not exist
-Class I does not exist
+Exception: Class I does not exist
+Exception: Class I does not exist
Fatal error: During inheritance of B with variance dependencies: Uncaught Exception: Class I does not exist in %s:%d
Stack trace:
diff --git a/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt b/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt
index 2b5a9c8423e..294e861d166 100644
--- a/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt
+++ b/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt
@@ -10,10 +10,10 @@ class X extends B {}
try {
class B extends A {
}
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Class "B" not found
+Error: Class "B" not found
diff --git a/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt b/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt
index 247e1cf2b10..659b5ebed7f 100644
--- a/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt
+++ b/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt
@@ -10,10 +10,10 @@ class X implements B {}
try {
interface B extends A {
}
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Interface "B" not found
+Error: Interface "B" not found
diff --git a/Zend/tests/undef_index_to_exception.phpt b/Zend/tests/undef_index_to_exception.phpt
index bbe13c0e71d..8416685fedb 100644
--- a/Zend/tests/undef_index_to_exception.phpt
+++ b/Zend/tests/undef_index_to_exception.phpt
@@ -10,37 +10,37 @@
$test = [];
try {
$test[0] .= "xyz";
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test);
try {
$test["key"] .= "xyz";
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test);
unset($test);
try {
$GLOBALS["test"] .= "xyz";
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($test);
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Undefined array key 0
+Exception: Undefined array key 0
array(0) {
}
-Undefined array key "key"
+Exception: Undefined array key "key"
array(0) {
}
-Undefined global variable $test
-Undefined variable $test
+Exception: Undefined global variable $test
+Exception: Undefined variable $test
diff --git a/Zend/tests/undefined_multidimensional_array.phpt b/Zend/tests/undefined_multidimensional_array.phpt
index 6593d6ba4ad..b74e03e056e 100644
--- a/Zend/tests/undefined_multidimensional_array.phpt
+++ b/Zend/tests/undefined_multidimensional_array.phpt
@@ -11,16 +11,16 @@
try {
$arr[1][2][3][4][5]->foo = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$arr[][] = 2;
try {
$arr[][]->bar = 2;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -62,5 +62,5 @@
Warning: Trying to access array offset on null in %s on line %d
Warning: Attempt to read property "foo" on null in %s on line %d
-Attempt to assign property "foo" on null
-Attempt to assign property "bar" on null
+Error: Attempt to assign property "foo" on null
+Error: Attempt to assign property "bar" on null
diff --git a/Zend/tests/unpack_iterator_by_ref_type_check.phpt b/Zend/tests/unpack_iterator_by_ref_type_check.phpt
index 2fef31056bd..742d3ab1a9a 100644
--- a/Zend/tests/unpack_iterator_by_ref_type_check.phpt
+++ b/Zend/tests/unpack_iterator_by_ref_type_check.phpt
@@ -9,10 +9,10 @@ function gen() {
}
try {
test(...gen());
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Cannot pass by-reference argument 1 of test() by unpacking a Traversable, passing by-value instead in %s on line %d
-test(): Argument #1 ($a) must be of type T, null given, called in %s on line %d
+TypeError: test(): Argument #1 ($a) must be of type T, null given, called in %s on line %d
diff --git a/Zend/tests/unset/unset_non_array.phpt b/Zend/tests/unset/unset_non_array.phpt
index 5d7ad4d44b8..e3d1ed2fa26 100644
--- a/Zend/tests/unset/unset_non_array.phpt
+++ b/Zend/tests/unset/unset_non_array.phpt
@@ -14,36 +14,36 @@
$x = true;
try {
unset($x[0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$x = 1;
try {
unset($x[0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$x = 3.14;
try {
unset($x[0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$x = "str";
try {
unset($x[0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$x = new stdClass;
try {
unset($x[0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// And now repeat the same with a nested offset.
@@ -60,36 +60,36 @@
$x = true;
try {
unset($x[0][0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$x = 1;
try {
unset($x[0][0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$x = 3.14;
try {
unset($x[0][0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$x = "str";
try {
unset($x[0][0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$x = new stdClass;
try {
unset($x[0][0]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -97,17 +97,17 @@
Warning: Undefined variable $x in %s on line %d
Deprecated: Automatic conversion of false to array is deprecated in %s
-Cannot unset offset in a non-array variable
-Cannot unset offset in a non-array variable
-Cannot unset offset in a non-array variable
-Cannot unset string offsets
-Cannot use object of type stdClass as array
+Error: Cannot unset offset in a non-array variable
+Error: Cannot unset offset in a non-array variable
+Error: Cannot unset offset in a non-array variable
+Error: Cannot unset string offsets
+Error: Cannot use object of type stdClass as array
Warning: Undefined variable $x in %s on line %d
Deprecated: Automatic conversion of false to array is deprecated in %s
-Cannot unset offset in a non-array variable
-Cannot unset offset in a non-array variable
-Cannot unset offset in a non-array variable
-Cannot use string offset as an array
-Cannot use object of type stdClass as array
+Error: Cannot unset offset in a non-array variable
+Error: Cannot unset offset in a non-array variable
+Error: Cannot unset offset in a non-array variable
+Error: Cannot use string offset as an array
+Error: Cannot use object of type stdClass as array
diff --git a/Zend/tests/varSyntax/constant_object_deref.phpt b/Zend/tests/varSyntax/constant_object_deref.phpt
index b25d6557440..0bc77f11492 100644
--- a/Zend/tests/varSyntax/constant_object_deref.phpt
+++ b/Zend/tests/varSyntax/constant_object_deref.phpt
@@ -8,17 +8,17 @@ class Bar { const FOO = "foo"; }
try {
FOO->length();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
Bar::FOO->length();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Call to a member function length() on string
-Call to a member function length() on string
+Error: Call to a member function length() on string
+Error: Call to a member function length() on string
diff --git a/Zend/tests/varSyntax/encapsed_string_deref.phpt b/Zend/tests/varSyntax/encapsed_string_deref.phpt
index 386e15932e6..cb21e879471 100644
--- a/Zend/tests/varSyntax/encapsed_string_deref.phpt
+++ b/Zend/tests/varSyntax/encapsed_string_deref.phpt
@@ -8,8 +8,8 @@
var_dump("foo$bar"->prop);
try {
var_dump("foo$bar"->method());
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
class FooBar { public static $prop = 42; }
@@ -24,6 +24,6 @@ function foobar() { return 42; }
Warning: Attempt to read property "prop" on string in %s on line %d
NULL
-Call to a member function method() on string
+Error: Call to a member function method() on string
int(42)
int(42)
diff --git a/Zend/tests/varSyntax/magic_const_deref.phpt b/Zend/tests/varSyntax/magic_const_deref.phpt
index 54a5c95069c..d227e2e013a 100644
--- a/Zend/tests/varSyntax/magic_const_deref.phpt
+++ b/Zend/tests/varSyntax/magic_const_deref.phpt
@@ -8,8 +8,8 @@ function test() {
var_dump(__FUNCTION__->prop);
try {
__FUNCTION__->method();
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -21,4 +21,4 @@ function test() {
Warning: Attempt to read property "prop" on string in %s on line %d
NULL
-Call to a member function method() on string
+Error: Call to a member function method() on string
diff --git a/Zend/tests/variadic/typehint_suppressed_error.phpt b/Zend/tests/variadic/typehint_suppressed_error.phpt
index 7cbc02bf581..fd9d304f1b2 100644
--- a/Zend/tests/variadic/typehint_suppressed_error.phpt
+++ b/Zend/tests/variadic/typehint_suppressed_error.phpt
@@ -9,10 +9,10 @@ function test(array... $args) {
try {
test([0], [1], 2);
-} catch(Error $e) {
- var_dump($e->getMessage());
+} catch(Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-string(%d) "test(): Argument #3 must be of type array, int given, called in %s on line %d"
+TypeError: test(): Argument #3 must be of type array, int given, called in %s on line %d
diff --git a/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt b/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt
index dd3c84518ea..830d1741fce 100644
--- a/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt
+++ b/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt
@@ -42,8 +42,8 @@
var_dump(!empty($map[$obj]));
try {
var_dump($map[$obj]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// It's okay to unset an object that's not in the map.
@@ -138,7 +138,7 @@
}
bool(false)
bool(false)
-Object stdClass#2 not contained in WeakMap
+Error: Object stdClass#2 not contained in WeakMap
Indirect modification:
object(WeakMap)#1 (2) {
diff --git a/Zend/tests/weakrefs/weakmap_error_conditions.phpt b/Zend/tests/weakrefs/weakmap_error_conditions.phpt
index 2516c0443fd..a903048fb14 100644
--- a/Zend/tests/weakrefs/weakmap_error_conditions.phpt
+++ b/Zend/tests/weakrefs/weakmap_error_conditions.phpt
@@ -6,39 +6,39 @@
$map = new WeakMap;
try {
$map[1] = 2;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($map[1]);
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
isset($map[1]);
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
unset($map[1]);
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$map[] = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$map[][1] = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($map[new stdClass]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($map->prop);
@@ -47,46 +47,46 @@
try {
$map->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$map->prop[] = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$r =& $map->prop;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
serialize($map);
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
unserialize('C:7:"WeakMap":0:{}');
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-WeakMap key must be an object
-WeakMap key must be an object
-WeakMap key must be an object
-WeakMap key must be an object
-Cannot append to WeakMap
-Cannot append to WeakMap
-Object stdClass#2 not contained in WeakMap
+TypeError: WeakMap key must be an object
+TypeError: WeakMap key must be an object
+TypeError: WeakMap key must be an object
+TypeError: WeakMap key must be an object
+Error: Cannot append to WeakMap
+Error: Cannot append to WeakMap
+Error: Object stdClass#2 not contained in WeakMap
Warning: Undefined property: WeakMap::$prop in %s on line %d
NULL
bool(false)
-Cannot create dynamic property WeakMap::$prop
-Cannot create dynamic property WeakMap::$prop
-Cannot create dynamic property WeakMap::$prop
-Serialization of 'WeakMap' is not allowed
-Unserialization of 'WeakMap' is not allowed
+Error: Cannot create dynamic property WeakMap::$prop
+Error: Cannot create dynamic property WeakMap::$prop
+Error: Cannot create dynamic property WeakMap::$prop
+Exception: Serialization of 'WeakMap' is not allowed
+Exception: Unserialization of 'WeakMap' is not allowed
diff --git a/Zend/tests/weakrefs/weakrefs_002.phpt b/Zend/tests/weakrefs/weakrefs_002.phpt
index eda6b25ec78..622c55de154 100644
--- a/Zend/tests/weakrefs/weakrefs_002.phpt
+++ b/Zend/tests/weakrefs/weakrefs_002.phpt
@@ -6,18 +6,18 @@
try {
serialize($wr);
-} catch (Exception $ex) {
- var_dump($ex->getMessage());
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
$wrs = 'O:13:"WeakReference":0:{}';
try {
var_dump(unserialize($wrs));
-} catch (Exception $ex) {
- var_dump($ex->getMessage());
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
-string(47) "Serialization of 'WeakReference' is not allowed"
-string(49) "Unserialization of 'WeakReference' is not allowed"
+Exception: Serialization of 'WeakReference' is not allowed
+Exception: Unserialization of 'WeakReference' is not allowed
diff --git a/Zend/tests/weakrefs/weakrefs_003.phpt b/Zend/tests/weakrefs/weakrefs_003.phpt
index 42fe0560a71..441b856ef3a 100644
--- a/Zend/tests/weakrefs/weakrefs_003.phpt
+++ b/Zend/tests/weakrefs/weakrefs_003.phpt
@@ -10,19 +10,19 @@
try {
$wr->disallow = "writes";
-} catch (Error $ex) {
- var_dump($ex->getMessage());
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
try {
$disallow = &$wr->disallowed;
-} catch (Error $ex) {
- var_dump($ex->getMessage());
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Undefined property: WeakReference::$disallow in %s on line %d
NULL
bool(false)
-string(55) "Cannot create dynamic property WeakReference::$disallow"
-string(57) "Cannot create dynamic property WeakReference::$disallowed"
+Error: Cannot create dynamic property WeakReference::$disallow
+Error: Cannot create dynamic property WeakReference::$disallowed
diff --git a/Zend/tests/weakrefs/weakrefs_006.phpt b/Zend/tests/weakrefs/weakrefs_006.phpt
index a15ab6b542d..dc432665d5c 100644
--- a/Zend/tests/weakrefs/weakrefs_006.phpt
+++ b/Zend/tests/weakrefs/weakrefs_006.phpt
@@ -113,4 +113,4 @@ public function __destruct() {
["value"]=>
int(9)
}
-}
\ No newline at end of file
+}
diff --git a/Zend/tests/xor_001.phpt b/Zend/tests/xor_001.phpt
index 9678af16b5f..82c592426e0 100644
--- a/Zend/tests/xor_001.phpt
+++ b/Zend/tests/xor_001.phpt
@@ -8,12 +8,12 @@
try {
$c = $a ^ $b;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "Done\n";
?>
--EXPECT--
-Unsupported operand types: array ^ array
+TypeError: Unsupported operand types: array ^ array
Done
diff --git a/Zend/tests/zpp/iterable_or_null.phpt b/Zend/tests/zpp/iterable_or_null.phpt
index a44e858bce9..ab5fc170aec 100644
--- a/Zend/tests/zpp/iterable_or_null.phpt
+++ b/Zend/tests/zpp/iterable_or_null.phpt
@@ -7,20 +7,20 @@
try {
var_dump(zend_iterable("string"));
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(zend_iterable(1));
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(zend_iterable(null));
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
@@ -34,14 +34,13 @@
try {
var_dump(zend_iterable([], "string"));
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, string given
-zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, int given
-zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, null given
-zend_iterable(): Argument #2 ($arg2) must be of type Traversable|array|null, string given
-
+TypeError: zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, string given
+TypeError: zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, int given
+TypeError: zend_iterable(): Argument #1 ($arg1) must be of type Traversable|array, null given
+TypeError: zend_iterable(): Argument #2 ($arg2) must be of type Traversable|array|null, string given