Commit 5f48e4d6a66 for php.net
commit 5f48e4d6a66c3cfe131e87c0060b2285bc1fb96a
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Sat Aug 22 20:18:48 2026 +0700
Zend: applied fixers to improve test robustness (part 4/8) (#23312)
diff --git a/Zend/tests/function_arguments/variadic_argument_type_error.phpt b/Zend/tests/function_arguments/variadic_argument_type_error.phpt
index 9041aadcadf..eb602deaa72 100644
--- a/Zend/tests/function_arguments/variadic_argument_type_error.phpt
+++ b/Zend/tests/function_arguments/variadic_argument_type_error.phpt
@@ -7,17 +7,17 @@ function foo($foo, int ...$bar) {}
try {
foo(1, []);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
foo(1, 1, 1, []);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECTF--
-foo(): Argument #2 must be of type int, array given, called in %s on line %d
-foo(): Argument #4 must be of type int, array given, called in %s on line %d
+TypeError: foo(): Argument #2 must be of type int, array given, called in %s on line %d
+TypeError: foo(): Argument #4 must be of type int, array given, called in %s on line %d
diff --git a/Zend/tests/gc/bug54305.phpt b/Zend/tests/gc/bug54305.phpt
index 61e351306f7..36f3f898d95 100644
--- a/Zend/tests/gc/bug54305.phpt
+++ b/Zend/tests/gc/bug54305.phpt
@@ -11,9 +11,9 @@ abstract class AbstractClass {
$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs');
try {
echo $methodWithArgs++;
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot increment ReflectionMethod
+TypeError: Cannot increment ReflectionMethod
diff --git a/Zend/tests/gc/bug80072.phpt b/Zend/tests/gc/bug80072.phpt
index d7bf1956cf6..a03bda77fbc 100644
--- a/Zend/tests/gc/bug80072.phpt
+++ b/Zend/tests/gc/bug80072.phpt
@@ -6,12 +6,12 @@
try {
$s = 'O:8:"stdClass":1:{s:1:"x";r:1;}';
unserialize($s) % gc_collect_cycles();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$a[]=&$a == $a=&$b > gc_collect_cycles();
?>
--EXPECT--
-Unsupported operand types: stdClass % int
+TypeError: Unsupported operand types: stdClass % int
diff --git a/Zend/tests/generators/bug79927.phpt b/Zend/tests/generators/bug79927.phpt
index df8f245ddfd..3b127a6ce51 100644
--- a/Zend/tests/generators/bug79927.phpt
+++ b/Zend/tests/generators/bug79927.phpt
@@ -11,8 +11,8 @@
$generator->next();
try {
$generator->rewind();
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $generator->current(), "\n";
@@ -26,6 +26,6 @@
?>
--EXPECT--
-Cannot rewind a generator that was already run
+Exception: Cannot rewind a generator that was already run
3
4
diff --git a/Zend/tests/generators/dynamic_properties.phpt b/Zend/tests/generators/dynamic_properties.phpt
index 08ceb7f581c..6fb6bcefbf3 100644
--- a/Zend/tests/generators/dynamic_properties.phpt
+++ b/Zend/tests/generators/dynamic_properties.phpt
@@ -10,10 +10,10 @@ function gen() {
$gen = gen();
try {
$gen->prop = new stdClass;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot create dynamic property Generator::$prop
+Error: Cannot create dynamic property Generator::$prop
diff --git a/Zend/tests/generators/errors/count_error.phpt b/Zend/tests/generators/errors/count_error.phpt
index 03ca1eed603..e912376c056 100644
--- a/Zend/tests/generators/errors/count_error.phpt
+++ b/Zend/tests/generators/errors/count_error.phpt
@@ -9,10 +9,10 @@ function gen() { yield; }
try {
count($gen);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-count(): Argument #1 ($value) must be of type Countable|array, Generator given
+TypeError: count(): Argument #1 ($value) must be of type Countable|array, Generator given
diff --git a/Zend/tests/generators/errors/resume_running_generator_error.phpt b/Zend/tests/generators/errors/resume_running_generator_error.phpt
index 53e8611cf36..c1a62dd7575 100644
--- a/Zend/tests/generators/errors/resume_running_generator_error.phpt
+++ b/Zend/tests/generators/errors/resume_running_generator_error.phpt
@@ -7,8 +7,8 @@ function gen() {
$gen = yield;
try {
$gen->next();
- } catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$gen->next();
}
@@ -19,7 +19,7 @@ function gen() {
?>
--EXPECTF--
-Exception: Cannot resume an already running generator
+Error: Cannot resume an already running generator
Fatal error: Uncaught Error: Cannot resume an already running generator in %s:%d
Stack trace:
diff --git a/Zend/tests/generators/errors/resume_running_generator_error_002.phpt b/Zend/tests/generators/errors/resume_running_generator_error_002.phpt
index e71e32a886d..8b0debf3bf8 100644
--- a/Zend/tests/generators/errors/resume_running_generator_error_002.phpt
+++ b/Zend/tests/generators/errors/resume_running_generator_error_002.phpt
@@ -10,8 +10,8 @@ function gen() {
try {
$gen->send($gen);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot resume an already running generator
+Error: Cannot resume an already running generator
diff --git a/Zend/tests/generators/generator_throwing_during_function_call.phpt b/Zend/tests/generators/generator_throwing_during_function_call.phpt
index bd0d2448b7d..885251f5838 100644
--- a/Zend/tests/generators/generator_throwing_during_function_call.phpt
+++ b/Zend/tests/generators/generator_throwing_during_function_call.phpt
@@ -19,8 +19,8 @@ function gen() {
try {
$gen->next();
-} catch (Exception $e) {
- echo 'Caught exception with message "', $e->getMessage(), '"', "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($gen->current());
@@ -28,5 +28,5 @@ function gen() {
?>
--EXPECT--
string(3) "foo"
-Caught exception with message "test"
+Exception: test
NULL
diff --git a/Zend/tests/generators/generator_throwing_exception.phpt b/Zend/tests/generators/generator_throwing_exception.phpt
index f537c3fc772..48cdfa9eda8 100644
--- a/Zend/tests/generators/generator_throwing_exception.phpt
+++ b/Zend/tests/generators/generator_throwing_exception.phpt
@@ -15,8 +15,8 @@ function gen() {
try {
$gen->next();
-} catch (Exception $e) {
- echo 'Caught exception with message "', $e->getMessage(), '"', "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($gen->current());
@@ -24,5 +24,5 @@ function gen() {
?>
--EXPECT--
string(3) "foo"
-Caught exception with message "test"
+Exception: test
NULL
diff --git a/Zend/tests/generators/generator_with_type_check_2.phpt b/Zend/tests/generators/generator_with_type_check_2.phpt
index 21e8ab8bedc..d1b8bb6798d 100644
--- a/Zend/tests/generators/generator_with_type_check_2.phpt
+++ b/Zend/tests/generators/generator_with_type_check_2.phpt
@@ -5,18 +5,18 @@
function gen(array $a) { yield; }
try {
gen(42);
-} catch (TypeError $e) {
- echo $e->getMessage()."\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
foreach (gen(42) as $val) {
var_dump($val);
}
-} catch (TypeError $e) {
- echo $e->getMessage()."\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d
-gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d
+TypeError: gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d
+TypeError: gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d
diff --git a/Zend/tests/generators/get_return_and_finally.phpt b/Zend/tests/generators/get_return_and_finally.phpt
index 8ced4d0008b..4892075f4d7 100644
--- a/Zend/tests/generators/get_return_and_finally.phpt
+++ b/Zend/tests/generators/get_return_and_finally.phpt
@@ -30,19 +30,19 @@ function gen2() {
// This will throw an exception (from the finally)
// during auto-priming, so fails
var_dump($gen->getReturn());
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
// This fails, because the return value was discarded
var_dump($gen->getReturn());
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
Deprecated: Returning from a finally block is deprecated in %s on line %d
int(42)
-gen2() throw
-Cannot get return value of a generator that hasn't returned
+Exception: gen2() throw
+Exception: Cannot get return value of a generator that hasn't returned
diff --git a/Zend/tests/generators/get_return_errors.phpt b/Zend/tests/generators/get_return_errors.phpt
index f8d50aa3ded..9db84883e27 100644
--- a/Zend/tests/generators/get_return_errors.phpt
+++ b/Zend/tests/generators/get_return_errors.phpt
@@ -13,8 +13,8 @@ function gen1() {
try {
// Generator hasn't reached the "return" yet
$gen->getReturn();
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
function gen2() {
@@ -26,14 +26,14 @@ function gen2() {
$gen = gen2();
try {
$gen->next();
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
// Generator has been aborted as a result of an exception
$gen->getReturn();
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
function gen3() {
@@ -46,8 +46,8 @@ function gen3() {
try {
// Generator throws during auto-priming of getReturn() call
$gen->getReturn();
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
function gen4() {
@@ -58,22 +58,22 @@ function gen4() {
$gen = gen4();
try {
$gen->throw(new Exception("gen4() throw"));
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
// Generator has been aborted as a result of an exception
// that was injected using throw()
$gen->getReturn();
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot get return value of a generator that hasn't returned
-gen2() throw
-Cannot get return value of a generator that hasn't returned
-gen3() throw
-gen4() throw
-Cannot get return value of a generator that hasn't returned
+Exception: Cannot get return value of a generator that hasn't returned
+Exception: gen2() throw
+Exception: Cannot get return value of a generator that hasn't returned
+Exception: gen3() throw
+Exception: gen4() throw
+Exception: Cannot get return value of a generator that hasn't returned
diff --git a/Zend/tests/generators/gh11028_1.phpt b/Zend/tests/generators/gh11028_1.phpt
index d1c07dc9de6..7bd6f1ce389 100644
--- a/Zend/tests/generators/gh11028_1.phpt
+++ b/Zend/tests/generators/gh11028_1.phpt
@@ -15,7 +15,7 @@ function test($msg, $x) {
try {
var_dump([...generator($x)]);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -27,10 +27,10 @@ function test($msg, $x) {
--EXPECTF--
Deprecated: Returning from a finally block is deprecated in %s on line %d
yield null
-Keys must be of type int|string during array unpacking
+Error: Keys must be of type int|string during array unpacking
yield false
-Keys must be of type int|string during array unpacking
+Error: Keys must be of type int|string during array unpacking
yield true
-Keys must be of type int|string during array unpacking
+Error: Keys must be of type int|string during array unpacking
yield object
-Keys must be of type int|string during array unpacking
+Error: Keys must be of type int|string during array unpacking
diff --git a/Zend/tests/generators/gh11028_3.phpt b/Zend/tests/generators/gh11028_3.phpt
index c58e00dc09b..d5eee0cfaad 100644
--- a/Zend/tests/generators/gh11028_3.phpt
+++ b/Zend/tests/generators/gh11028_3.phpt
@@ -14,9 +14,9 @@ function generator() {
try {
var_dump([...generator()]);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
Deprecated: Returning from a finally block is deprecated in %s on line %d
-exception
+Exception: exception
diff --git a/Zend/tests/generators/throw_into_yield_from_array.phpt b/Zend/tests/generators/throw_into_yield_from_array.phpt
index aa9fa822061..5cef784dfce 100644
--- a/Zend/tests/generators/throw_into_yield_from_array.phpt
+++ b/Zend/tests/generators/throw_into_yield_from_array.phpt
@@ -19,8 +19,8 @@ function test($g) {
var_dump($g->current());
try {
$g->throw(new Exception("Exception!"));
- } catch (Exception $e) {
- echo "{$e->getMessage()}\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($g->current());
}
@@ -35,9 +35,9 @@ function test($g) {
?>
--EXPECT--
int(1)
-Exception!
+Exception: Exception!
NULL
int(1)
-Exception!
+Exception: Exception!
NULL
diff --git a/Zend/tests/generators/yield_from_non_iterable.phpt b/Zend/tests/generators/yield_from_non_iterable.phpt
index 705bcaec351..7b1d21afbe7 100644
--- a/Zend/tests/generators/yield_from_non_iterable.phpt
+++ b/Zend/tests/generators/yield_from_non_iterable.phpt
@@ -9,10 +9,10 @@ function gen() {
try {
gen()->current();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Can use "yield from" only with arrays and Traversables
+Error: Can use "yield from" only with arrays and Traversables
diff --git a/Zend/tests/generators/yield_from_valid_exception.phpt b/Zend/tests/generators/yield_from_valid_exception.phpt
index 0df541499ca..2ae43e9ad59 100644
--- a/Zend/tests/generators/yield_from_valid_exception.phpt
+++ b/Zend/tests/generators/yield_from_valid_exception.phpt
@@ -17,8 +17,8 @@ function gen() {
try {
// the fact that the yield from result is used is relevant.
var_dump(yield from new FooBar);
- } catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -27,4 +27,4 @@ function gen() {
?>
--EXPECT--
-Exception from valid()
+Exception: Exception from valid()
diff --git a/Zend/tests/get_called_class_001.phpt b/Zend/tests/get_called_class_001.phpt
index caa6d154d9c..d9a6a090e30 100644
--- a/Zend/tests/get_called_class_001.phpt
+++ b/Zend/tests/get_called_class_001.phpt
@@ -5,10 +5,10 @@
try {
var_dump(get_called_class());
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-get_called_class() must be called from within a class
+Error: get_called_class() must be called from within a class
diff --git a/Zend/tests/get_class_basic.phpt b/Zend/tests/get_class_basic.phpt
index f6dcbccb691..bcdfeb22df9 100644
--- a/Zend/tests/get_class_basic.phpt
+++ b/Zend/tests/get_class_basic.phpt
@@ -11,8 +11,8 @@ function testNull ()
{
try {
var_dump(get_class(null));
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
@@ -28,8 +28,8 @@ class foo2 extends foo {
});
try {
$f1->bar();
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
set_error_handler(null);
@@ -37,13 +37,13 @@ class foo2 extends foo {
try {
var_dump(get_class());
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(get_class("qwerty"));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(get_class($f1));
@@ -54,13 +54,13 @@ class foo2 extends foo {
echo "Done\n";
?>
--EXPECTF--
-Calling get_class() without arguments is deprecated
+Exception: Calling get_class() without arguments is deprecated
Deprecated: Calling get_class() without arguments is deprecated in %s on line %d
string(3) "foo"
-get_class() without arguments must be called from within a class
-get_class(): Argument #1 ($object) must be of type object, string given
+Error: get_class() without arguments must be called from within a class
+TypeError: get_class(): Argument #1 ($object) must be of type object, string given
string(3) "foo"
string(4) "foo2"
-get_class(): Argument #1 ($object) must be of type object, null given
+TypeError: get_class(): Argument #1 ($object) must be of type object, null given
Done
diff --git a/Zend/tests/get_class_vars/get_class_vars_001.phpt b/Zend/tests/get_class_vars/get_class_vars_001.phpt
index a884409121c..1f514b4aee3 100644
--- a/Zend/tests/get_class_vars/get_class_vars_001.phpt
+++ b/Zend/tests/get_class_vars/get_class_vars_001.phpt
@@ -21,8 +21,8 @@ class B extends A {
try {
get_class_vars("Unknown");
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -37,4 +37,4 @@ class B extends A {
["aa"]=>
int(4)
}
-get_class_vars(): Argument #1 ($class) must be a valid class name, "Unknown" given
+TypeError: get_class_vars(): Argument #1 ($class) must be a valid class name, "Unknown" given
diff --git a/Zend/tests/get_parent_class_basic.phpt b/Zend/tests/get_parent_class_basic.phpt
index 8eabd64ca45..12071196d7a 100644
--- a/Zend/tests/get_parent_class_basic.phpt
+++ b/Zend/tests/get_parent_class_basic.phpt
@@ -27,8 +27,8 @@ function test_bar() {
});
try {
$foo->test();
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
set_error_handler(null);
@@ -44,40 +44,40 @@ function test_bar() {
try {
get_parent_class("");
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
get_parent_class("[[[[");
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
get_parent_class(" ");
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
var_dump(get_parent_class(new stdclass));
try {
get_parent_class(array());
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
get_parent_class(1);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
echo "Done\n";
?>
--EXPECTF--
-Calling get_parent_class() without arguments is deprecated
+Exception: Calling get_parent_class() without arguments is deprecated
Deprecated: Calling get_parent_class() without arguments is deprecated in %s on line %d
bool(false)
@@ -90,10 +90,10 @@ function test_bar() {
string(3) "foo"
bool(false)
bool(false)
-get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, "" given
-get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, "[[[[" given
-get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, " " given
+TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, "" given
+TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, "[[[[" given
+TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, " " given
bool(false)
-get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given
-get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given
+TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given
+TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given
Done
diff --git a/Zend/tests/gh10169.phpt b/Zend/tests/gh10169.phpt
index 674122ac593..44f62b7dcd5 100644
--- a/Zend/tests/gh10169.phpt
+++ b/Zend/tests/gh10169.phpt
@@ -19,19 +19,19 @@ public function __toString()
$a = new A();
try {
$a->prop = new B();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$a = new A();
$a->prop = '';
try {
$a->prop = new B();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Object was released while assigning to property A::$prop
-Object was released while assigning to property A::$prop
+Error: Object was released while assigning to property A::$prop
+Error: Object was released while assigning to property A::$prop
diff --git a/Zend/tests/gh10497_non_object.phpt b/Zend/tests/gh10497_non_object.phpt
index 546e9718443..837fdf827c4 100644
--- a/Zend/tests/gh10497_non_object.phpt
+++ b/Zend/tests/gh10497_non_object.phpt
@@ -5,20 +5,20 @@
try {
TRUE->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
NULL->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
PHP_INT_MAX->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
class C {
@@ -33,47 +33,47 @@ public static function fromSelf(): void {
try {
C::INT->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
C::STR->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
C::ARR->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
C::fromSelf();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Other write contexts: compound assignment, unset() and by-reference arguments.
try {
C::INT->prop++;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
C::INT->prop .= 'x';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
function byRef(&$v) {}
try {
byRef(C::INT->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// As for plain variables, unsetting a property of a non-object is a silent no-op.
@@ -85,27 +85,27 @@ function byRef(&$v) {}
try {
__COMPILER_HALT_OFFSET__->prop = 1;
-} catch (Error $e) {
- echo $e::class, $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
__halt_compiler();
?>
--EXPECT--
-Attempt to assign property "prop" on true
-Attempt to assign property "prop" on null
-Attempt to assign property "prop" on int
-Attempt to assign property "prop" on int
-Attempt to assign property "prop" on string
-Attempt to assign property "prop" on array
-Attempt to assign property "prop" on int
-Attempt to increment/decrement property "prop" on int
-Attempt to assign property "prop" on int
-Attempt to modify property "prop" on int
+Error: Attempt to assign property "prop" on true
+Error: Attempt to assign property "prop" on null
+Error: Attempt to assign property "prop" on int
+Error: Attempt to assign property "prop" on int
+Error: Attempt to assign property "prop" on string
+Error: Attempt to assign property "prop" on array
+Error: Attempt to assign property "prop" on int
+Error: Attempt to increment/decrement property "prop" on int
+Error: Attempt to assign property "prop" on int
+Error: Attempt to modify property "prop" on int
unset() did not error
bool(true)
int(5)
string(3) "str"
bool(false)
-ErrorAttempt to assign property "prop" on int
+Error: Attempt to assign property "prop" on int
diff --git a/Zend/tests/gh10634.phpt b/Zend/tests/gh10634.phpt
index 41407bf307d..cd36411b379 100644
--- a/Zend/tests/gh10634.phpt
+++ b/Zend/tests/gh10634.phpt
@@ -6,7 +6,7 @@ function test_input($input) {
try {
eval($input);
} catch(Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -17,8 +17,8 @@ function test_input($input) {
test_input("y&//");
?>
--EXPECT--
-string(36) "Unterminated comment starting line 1"
-string(36) "Unterminated comment starting line 1"
-string(36) "syntax error, unexpected end of file"
-string(36) "syntax error, unexpected end of file"
-string(36) "syntax error, unexpected end of file"
+ParseError: Unterminated comment starting line 1
+ParseError: Unterminated comment starting line 1
+ParseError: syntax error, unexpected end of file
+ParseError: syntax error, unexpected end of file
+ParseError: syntax error, unexpected end of file
diff --git a/Zend/tests/gh12102_1.phpt b/Zend/tests/gh12102_1.phpt
index 1d548d6b28f..84fb628525d 100644
--- a/Zend/tests/gh12102_1.phpt
+++ b/Zend/tests/gh12102_1.phpt
@@ -7,8 +7,8 @@ function test() {
byVal(func_get_args()[0]);
try {
byRef(func_get_args()[0]);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -27,4 +27,4 @@ function byRef(&$arg) {
?>
--EXPECT--
string(1) "y"
-Cannot use temporary expression in write context
+Error: Cannot use temporary expression in write context
diff --git a/Zend/tests/gh12102_3.phpt b/Zend/tests/gh12102_3.phpt
index 741bce5ab1b..99c51d5188c 100644
--- a/Zend/tests/gh12102_3.phpt
+++ b/Zend/tests/gh12102_3.phpt
@@ -7,8 +7,8 @@ function test() {
byVal(C[0]);
try {
byRef(C[0]);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -29,4 +29,4 @@ function byRef(&$arg) {
?>
--EXPECT--
string(3) "foo"
-Cannot use temporary expression in write context
+Error: Cannot use temporary expression in write context
diff --git a/Zend/tests/gh14969.phpt b/Zend/tests/gh14969.phpt
index dedbaa7456e..a69a739f0e3 100644
--- a/Zend/tests/gh14969.phpt
+++ b/Zend/tests/gh14969.phpt
@@ -20,7 +20,7 @@ class D {
try {
$d->prop = $c;
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($d);
@@ -29,18 +29,18 @@ class D {
try {
$d->prop = $c;
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($d);
?>
--EXPECTF--
-C::__toString
+Exception: C::__toString
object(D)#%d (0) {
["prop"]=>
uninitialized(string)
}
-C::__toString
+Exception: C::__toString
object(D)#2 (1) {
["prop"]=>
string(3) "foo"
diff --git a/Zend/tests/gh17162.phpt b/Zend/tests/gh17162.phpt
index bdf6ddbb36b..fb416cae26a 100644
--- a/Zend/tests/gh17162.phpt
+++ b/Zend/tests/gh17162.phpt
@@ -13,9 +13,9 @@ function __destruct() {
// but any function that uses zend_try_array_init() would work.
try {
getimagesize("dummy", $box);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Attempt to assign property "value" on null
+Error: Attempt to assign property "value" on null
diff --git a/Zend/tests/gh18736.phpt b/Zend/tests/gh18736.phpt
index f397ee39a31..385ab0f99ed 100644
--- a/Zend/tests/gh18736.phpt
+++ b/Zend/tests/gh18736.phpt
@@ -15,10 +15,10 @@ function &test(): int {
try {
$x = &test();
var_dump($x);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-test(): Return value must be of type int, string returned
+TypeError: test(): Return value must be of type int, string returned
diff --git a/Zend/tests/gh19304.phpt b/Zend/tests/gh19304.phpt
index 47e20af6462..f3f7fab3f1f 100644
--- a/Zend/tests/gh19304.phpt
+++ b/Zend/tests/gh19304.phpt
@@ -9,10 +9,10 @@
try {
$foo->v = 0;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign int to property class@anonymous::$v of type self
+TypeError: Cannot assign int to property class@anonymous::$v of type self
diff --git a/Zend/tests/gh19306.phpt b/Zend/tests/gh19306.phpt
index e19735d94c8..9f98dd4cc6e 100644
--- a/Zend/tests/gh19306.phpt
+++ b/Zend/tests/gh19306.phpt
@@ -26,7 +26,7 @@ function g()
try {
$a->next();
} catch (Throwable $t) {
- echo $t->getMessage(), "\n";
+ echo $t::class, ': ', $t->getMessage(), "\n";
}
echo "Destroying fiber\n";
$fiber = null;
@@ -35,6 +35,6 @@ function g()
--EXPECT--
Fiber start
Fiber suspended
-Cannot resume an already running generator
+Error: Cannot resume an already running generator
Destroying fiber
Shutdown
diff --git a/Zend/tests/gh19326.phpt b/Zend/tests/gh19326.phpt
index 335fdd382ea..630d7ce2e8b 100644
--- a/Zend/tests/gh19326.phpt
+++ b/Zend/tests/gh19326.phpt
@@ -25,12 +25,12 @@ function g() {
try {
$b->throw(new Exception('test'));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$fiber->resume();
?>
--EXPECT--
-Cannot resume an already running generator
+Error: Cannot resume an already running generator
diff --git a/Zend/tests/gh19719.phpt b/Zend/tests/gh19719.phpt
index 715e847846f..9042b4139ab 100644
--- a/Zend/tests/gh19719.phpt
+++ b/Zend/tests/gh19719.phpt
@@ -12,10 +12,10 @@ function takesInt(int $x) {}
try {
takesInt('42');
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-takesInt(): Argument #1 ($x) must be of type int, string given, called in %s on line %d
+TypeError: takesInt(): Argument #1 ($x) must be of type int, string given, called in %s on line %d
diff --git a/Zend/tests/gh20564.phpt b/Zend/tests/gh20564.phpt
index 53311d952de..6962c7f19bd 100644
--- a/Zend/tests/gh20564.phpt
+++ b/Zend/tests/gh20564.phpt
@@ -16,9 +16,9 @@ function __call($method, $args) {
try {
(new A)->test();
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-array_map(): Argument #1 ($callback) must be a valid callback or null, class "B" not found
+TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, class "B" not found
diff --git a/Zend/tests/gh23088.phpt b/Zend/tests/gh23088.phpt
index 59153a1f2ba..a979f47d784 100644
--- a/Zend/tests/gh23088.phpt
+++ b/Zend/tests/gh23088.phpt
@@ -24,17 +24,17 @@
try {
var_dump($a == $b);
-} catch (Error $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($a === $b);
-} catch (Error $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Maximum call stack size reached during comparison
-Maximum call stack size reached during comparison
+Error: Maximum call stack size reached during comparison
+Error: Maximum call stack size reached during comparison
diff --git a/Zend/tests/gh418106144.phpt b/Zend/tests/gh418106144.phpt
index 9357b0a179b..c2d689c7ec1 100644
--- a/Zend/tests/gh418106144.phpt
+++ b/Zend/tests/gh418106144.phpt
@@ -11,10 +11,10 @@ function test($y=new Foo>''){
}
try {
test();
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Foo::__toString(): Return value must be of type string, none returned
+TypeError: Foo::__toString(): Return value must be of type string, none returned
diff --git a/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt b/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt
index d0e9ddcba41..b306eb884c7 100644
--- a/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt
+++ b/Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt
@@ -17,10 +17,10 @@ public function __set($name, $value) {
try {
$foo->foo()->baz ??= 1;
-} catch (Exception $e) {
- echo $e->getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Hello
+Exception: Hello
diff --git a/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt b/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt
index 4115d9eae26..e4516a1eece 100644
--- a/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt
+++ b/Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt
@@ -15,10 +15,10 @@ public function foo() {
try {
$foo->foo()->prop ??= 'foo';
-} catch (Error $e) {
- echo $e->getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign string to property Foo::$prop of type int
+TypeError: Cannot assign string to property Foo::$prop of type int
diff --git a/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt b/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt
index f2808afbf84..3aa8d89fb31 100644
--- a/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt
+++ b/Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt
@@ -13,10 +13,10 @@ function newFoo() {
try {
newFoo()->prop ??= 'foo';
-} catch (Error $e) {
- echo $e->getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot assign string to property Foo::$prop of type int
+TypeError: Cannot assign string to property Foo::$prop of type int
diff --git a/Zend/tests/global_to_string_exception.phpt b/Zend/tests/global_to_string_exception.phpt
index 0c55a8c3d62..25ea7cc4c78 100644
--- a/Zend/tests/global_to_string_exception.phpt
+++ b/Zend/tests/global_to_string_exception.phpt
@@ -5,10 +5,10 @@
try {
global ${new stdClass};
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Object of class stdClass could not be converted to string
+Error: Object of class stdClass could not be converted to string
diff --git a/Zend/tests/illegal_offset_unset_isset_empty.phpt b/Zend/tests/illegal_offset_unset_isset_empty.phpt
index ee837f0b614..2a78387f4c6 100644
--- a/Zend/tests/illegal_offset_unset_isset_empty.phpt
+++ b/Zend/tests/illegal_offset_unset_isset_empty.phpt
@@ -6,22 +6,22 @@
$ary = [];
try {
unset($ary[[]]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
isset($ary[[]]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
empty($ary[[]]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot unset offset of type array on array
-Cannot access offset of type array in isset or empty
-Cannot access offset of type array in isset or empty
+TypeError: Cannot unset offset of type array on array
+TypeError: Cannot access offset of type array in isset or empty
+TypeError: Cannot access offset of type array in isset or empty
diff --git a/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt b/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt
index 21b4a9b0168..1384661d25c 100644
--- a/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt
+++ b/Zend/tests/in-de-crement/decrement_with_castable_objects_no_subtraction.phpt
@@ -13,64 +13,64 @@
/* Check normal arithmetic */
try {
var_dump($l - 1);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($f - 1);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($nl - 1);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($nf - 1);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
/* Decrement */
try {
$l--;
var_dump($l);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$f--;
var_dump($f);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$nl--;
var_dump($nl);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$nf--;
var_dump($nf);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Unsupported operand types: LongCastableNoOperations - int
-Unsupported operand types: FloatCastableNoOperations - int
+TypeError: Unsupported operand types: LongCastableNoOperations - int
+TypeError: Unsupported operand types: FloatCastableNoOperations - int
int(51)
float(57.3)
-Cannot decrement LongCastableNoOperations
-Cannot decrement FloatCastableNoOperations
+TypeError: Cannot decrement LongCastableNoOperations
+TypeError: Cannot decrement FloatCastableNoOperations
int(51)
float(57.3)
diff --git a/Zend/tests/in-de-crement/incdec_bool_exception.phpt b/Zend/tests/in-de-crement/incdec_bool_exception.phpt
index f819af1e239..3ebad74c0a0 100644
--- a/Zend/tests/in-de-crement/incdec_bool_exception.phpt
+++ b/Zend/tests/in-de-crement/incdec_bool_exception.phpt
@@ -11,18 +11,18 @@
foreach ($values as $value) {
try {
$value++;
- } catch (\Exception $e) {
- echo $e->getMessage(), PHP_EOL;
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$value--;
- } catch (\Exception $e) {
- echo $e->getMessage(), PHP_EOL;
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
?>
--EXPECT--
-Increment on type bool has no effect, this will change in the next major version of PHP
-Decrement on type bool has no effect, this will change in the next major version of PHP
-Increment on type bool has no effect, this will change in the next major version of PHP
-Decrement on type bool has no effect, this will change in the next major version of PHP
+Exception: Increment on type bool has no effect, this will change in the next major version of PHP
+Exception: Decrement on type bool has no effect, this will change in the next major version of PHP
+Exception: Increment on type bool has no effect, this will change in the next major version of PHP
+Exception: Decrement on type bool has no effect, this will change in the next major version of PHP
diff --git a/Zend/tests/in-de-crement/incdec_strings_exception.phpt b/Zend/tests/in-de-crement/incdec_strings_exception.phpt
index 5acbb104122..c6a1891c991 100644
--- a/Zend/tests/in-de-crement/incdec_strings_exception.phpt
+++ b/Zend/tests/in-de-crement/incdec_strings_exception.phpt
@@ -28,48 +28,48 @@
foreach ($values as $value) {
try {
$value++;
- } catch (\Exception $e) {
- echo $e->getMessage(), PHP_EOL;
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($value);
try {
$value--;
- } catch (\Exception $e) {
- echo $e->getMessage(), PHP_EOL;
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($value);
}
?>
--EXPECT--
-Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
+Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
string(0) ""
-Deprecated: Decrement on empty string is deprecated as non-numeric
+Exception: Deprecated: Decrement on empty string is deprecated as non-numeric
string(0) ""
-Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
+Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
string(1) " "
-Deprecated: Decrement on non-numeric string has no effect and is deprecated
+Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated
string(1) " "
-Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
+Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
string(4) "199A"
-Deprecated: Decrement on non-numeric string has no effect and is deprecated
+Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated
string(4) "199A"
-Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
+Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
string(4) "A199"
-Deprecated: Decrement on non-numeric string has no effect and is deprecated
+Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated
string(4) "A199"
-Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
+Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
string(4) "199Z"
-Deprecated: Decrement on non-numeric string has no effect and is deprecated
+Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated
string(4) "199Z"
-Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
+Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
string(4) "Z199"
-Deprecated: Decrement on non-numeric string has no effect and is deprecated
+Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated
string(4) "Z199"
-Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
+Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
string(11) "Hello world"
-Deprecated: Decrement on non-numeric string has no effect and is deprecated
+Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated
string(11) "Hello world"
-Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
+Exception: Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
string(4) "🐘"
-Deprecated: Decrement on non-numeric string has no effect and is deprecated
+Exception: Deprecated: Decrement on non-numeric string has no effect and is deprecated
string(4) "🐘"
diff --git a/Zend/tests/in-de-crement/incdec_types.phpt b/Zend/tests/in-de-crement/incdec_types.phpt
index 755b63957ef..9b99b9baa45 100644
--- a/Zend/tests/in-de-crement/incdec_types.phpt
+++ b/Zend/tests/in-de-crement/incdec_types.phpt
@@ -9,13 +9,13 @@
foreach ($types as $type) {
try {
$type++;
- } catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$type--;
- } catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -40,12 +40,12 @@
}
?>
--EXPECTF--
-Cannot increment array
-Cannot decrement array
-Cannot increment stdClass
-Cannot decrement stdClass
-Cannot increment resource
-Cannot decrement resource
+TypeError: Cannot increment array
+TypeError: Cannot decrement array
+TypeError: Cannot increment stdClass
+TypeError: Cannot decrement stdClass
+TypeError: Cannot increment resource
+TypeError: Cannot decrement resource
Using increment:
Initial value:NULL
Result value:int(1)
diff --git a/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt b/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt
index cf08055383e..8ee4cd33856 100644
--- a/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt
+++ b/Zend/tests/in-de-crement/increment_with_castable_objects_no_addition.phpt
@@ -13,64 +13,64 @@
/* Check normal arithmetic */
try {
var_dump($l + 1);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($f + 1);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($nl + 1);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($nf + 1);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
/* Decrement */
try {
$l++;
var_dump($l);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$f++;
var_dump($f);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$nl++;
var_dump($nl);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$nf++;
var_dump($nf);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Unsupported operand types: LongCastableNoOperations + int
-Unsupported operand types: FloatCastableNoOperations + int
+TypeError: Unsupported operand types: LongCastableNoOperations + int
+TypeError: Unsupported operand types: FloatCastableNoOperations + int
int(53)
float(59.3)
-Cannot increment LongCastableNoOperations
-Cannot increment FloatCastableNoOperations
+TypeError: Cannot increment LongCastableNoOperations
+TypeError: Cannot increment FloatCastableNoOperations
int(53)
float(59.3)
diff --git a/Zend/tests/in-de-crement/object_cannot_incdec.phpt b/Zend/tests/in-de-crement/object_cannot_incdec.phpt
index 39a41d61dd3..cfa5cca2dd5 100644
--- a/Zend/tests/in-de-crement/object_cannot_incdec.phpt
+++ b/Zend/tests/in-de-crement/object_cannot_incdec.phpt
@@ -7,39 +7,39 @@ class Foo { }
try {
$o++;
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
var_dump($o);
}
try {
$o--;
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
var_dump($o);
}
try {
++$o;
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
var_dump($o);
}
try {
--$o;
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
var_dump($o);
}
?>
--EXPECT--
-Cannot increment Foo
+TypeError: Cannot increment Foo
object(Foo)#1 (0) {
}
-Cannot decrement Foo
+TypeError: Cannot decrement Foo
object(Foo)#1 (0) {
}
-Cannot increment Foo
+TypeError: Cannot increment Foo
object(Foo)#1 (0) {
}
-Cannot decrement Foo
+TypeError: Cannot decrement Foo
object(Foo)#1 (0) {
}
diff --git a/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt b/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt
index b4c193a6718..370fe8603fd 100644
--- a/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt
+++ b/Zend/tests/in-de-crement/object_cannot_incdec_use_result_op.phpt
@@ -7,39 +7,39 @@ class Foo { }
try {
$y = $o++;
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
var_dump($o);
}
try {
$y = $o--;
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
var_dump($o);
}
try {
$y = ++$o;
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
var_dump($o);
}
try {
$y = --$o;
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
var_dump($o);
}
?>
--EXPECT--
-Cannot increment Foo
+TypeError: Cannot increment Foo
object(Foo)#1 (0) {
}
-Cannot decrement Foo
+TypeError: Cannot decrement Foo
object(Foo)#1 (0) {
}
-Cannot increment Foo
+TypeError: Cannot increment Foo
object(Foo)#1 (0) {
}
-Cannot decrement Foo
+TypeError: Cannot decrement Foo
object(Foo)#1 (0) {
}
diff --git a/Zend/tests/in-de-crement/oss_fuzz_63802.phpt b/Zend/tests/in-de-crement/oss_fuzz_63802.phpt
index 51b4c8f1fd7..96b50d1022f 100644
--- a/Zend/tests/in-de-crement/oss_fuzz_63802.phpt
+++ b/Zend/tests/in-de-crement/oss_fuzz_63802.phpt
@@ -21,14 +21,14 @@ public function postDec() {
foreach (['inc', 'dec'] as $incDec) {
try {
$foo->{$prePost . ucfirst($incDec)}();
- } catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
?>
--EXPECT--
-Cannot increment Foo
-Cannot decrement Foo
-Cannot increment Foo
-Cannot decrement Foo
+TypeError: Cannot increment Foo
+TypeError: Cannot decrement Foo
+TypeError: Cannot increment Foo
+TypeError: Cannot decrement Foo
diff --git a/Zend/tests/in-de-crement/overloaded_access.phpt b/Zend/tests/in-de-crement/overloaded_access.phpt
index 56a5c2b1d47..feb15c60c6c 100644
--- a/Zend/tests/in-de-crement/overloaded_access.phpt
+++ b/Zend/tests/in-de-crement/overloaded_access.phpt
@@ -22,15 +22,15 @@ function offsetUnset($index): void {
try {
$foo[0]++;
} catch (Throwable $ex) {
- echo $ex->getMessage() . "\n";
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
$foo = new Foo;
try {
$foo[0]--;
} catch (Throwable $ex) {
- echo $ex->getMessage() . "\n";
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot increment array
-Cannot decrement array
+TypeError: Cannot increment array
+TypeError: Cannot decrement array
diff --git a/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt b/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt
index d435c9fb402..8b8b0a1fe71 100644
--- a/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt
+++ b/Zend/tests/in-de-crement/unset_property_converted_to_obj_in_error_handler.phpt
@@ -14,12 +14,12 @@ function errorHandler() {
try {
(++$c->a);
-} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($c->a);
?>
--EXPECT--
-Cannot increment stdClass
+TypeError: Cannot increment stdClass
object(stdClass)#2 (0) {
}
diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt
index 3fe0456175f..a50c769b3da 100644
--- a/Zend/tests/incompat_ctx_user.phpt
+++ b/Zend/tests/incompat_ctx_user.phpt
@@ -13,8 +13,8 @@ function bar() { A::foo(); }
try {
$b->bar();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Exception: Non-static method A::foo() cannot be called statically
+Error: Non-static method A::foo() cannot be called statically
diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt
index 66b20da03a0..acb1ab10874 100644
--- a/Zend/tests/indexing_001.phpt
+++ b/Zend/tests/indexing_001.phpt
@@ -9,8 +9,8 @@
foreach ($testvalues as $testvalue) {
try {
$testvalue['foo']=$array;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($testvalue);
}
@@ -21,8 +21,8 @@
foreach ($testvalues as $testvalue) {
try {
$testvalue['foo']=&$array;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($testvalue);
}
@@ -33,8 +33,8 @@
foreach ($testvalues as $testvalue) {
try {
$testvalue[]=$array;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump ($testvalue);
}
@@ -45,8 +45,8 @@
foreach ($testvalues as $testvalue) {
try {
$testvalue[]=&$array;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump ($testvalue);
}
@@ -61,11 +61,11 @@
int(1)
}
}
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
int(0)
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
int(1)
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
bool(true)
Deprecated: Automatic conversion of false to array is deprecated in %s
@@ -76,11 +76,11 @@
int(1)
}
}
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
string(0) ""
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
string(1) " "
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
float(0.1)
array(1) {
["foo"]=>
@@ -98,11 +98,11 @@
int(1)
}
}
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
int(0)
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
int(1)
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
bool(true)
Deprecated: Automatic conversion of false to array is deprecated in %s
@@ -113,7 +113,7 @@
int(1)
}
}
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
float(0.1)
array(1) {
["foo"]=>
@@ -130,11 +130,11 @@
int(1)
}
}
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
int(0)
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
int(1)
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
bool(true)
Deprecated: Automatic conversion of false to array is deprecated in %s
@@ -145,7 +145,7 @@
int(1)
}
}
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
float(0.1)
array(1) {
[0]=>
@@ -163,11 +163,11 @@
int(1)
}
}
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
int(0)
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
int(1)
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
bool(true)
Deprecated: Automatic conversion of false to array is deprecated in %s
@@ -178,7 +178,7 @@
int(1)
}
}
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
float(0.1)
array(1) {
[0]=>
diff --git a/Zend/tests/indirect_function_call/indirect_call_array_003.phpt b/Zend/tests/indirect_function_call/indirect_call_array_003.phpt
index 603b3bfc299..30d84109ce3 100644
--- a/Zend/tests/indirect_function_call/indirect_call_array_003.phpt
+++ b/Zend/tests/indirect_function_call/indirect_call_array_003.phpt
@@ -20,7 +20,7 @@ static public function __callStatic($a, $b) {
try {
$arr();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo = new foo;
$arr = array($foo, 'abc');
@@ -31,7 +31,7 @@ static public function __callStatic($a, $b) {
--EXPECTF--
From foo::__callStatic:
string(3) "abc"
-Exception: Using $this when not in object context
+Error: Using $this when not in object context
From foo::__call:
string(3) "abc"
object(foo)#%d (0) {
diff --git a/Zend/tests/indirect_function_call/indirect_call_array_004.phpt b/Zend/tests/indirect_function_call/indirect_call_array_004.phpt
index e8520efd12b..c1992a28908 100644
--- a/Zend/tests/indirect_function_call/indirect_call_array_004.phpt
+++ b/Zend/tests/indirect_function_call/indirect_call_array_004.phpt
@@ -23,8 +23,8 @@ static public function __callStatic($a, $b) {
try {
$arr();
}
-catch (Exception $e) {
- echo $e->getMessage(), "\n";
+catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$arr = array('foo', '123');
@@ -32,8 +32,8 @@ static public function __callStatic($a, $b) {
try {
$arr();
}
-catch (Exception $e) {
- echo $e->getMessage(), "\n";
+catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
@@ -45,8 +45,8 @@ static public function __callStatic($a, $b) {
try {
$arr();
}
-catch (Exception $e) {
- echo $e->getMessage(), "\n";
+catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
@@ -56,16 +56,16 @@ static public function __callStatic($a, $b) {
try {
$arr();
}
-catch (Exception $e) {
- echo $e->getMessage(), "\n";
+catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-foo
+Exception: foo
From foo::__callStatic:
-123
+Exception: 123
------
-foo
+Exception: foo
From foo::__call:
-123
+Exception: 123
diff --git a/Zend/tests/indirect_function_call/indirect_call_string_002.phpt b/Zend/tests/indirect_function_call/indirect_call_string_002.phpt
index 7704c1cd9a4..2c5c22a29ad 100644
--- a/Zend/tests/indirect_function_call/indirect_call_string_002.phpt
+++ b/Zend/tests/indirect_function_call/indirect_call_string_002.phpt
@@ -22,65 +22,65 @@ public static function __callStatic($method, array $args)
$callback = ['', 'method'];
try {
$callback();
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Test Class::method syntax with empty class name
$callback = '::method';
try {
$callback();
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Test array syntax with empty class and method name
$callback = ['', ''];
try {
$callback();
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Test Class::method syntax with empty class and method name
$callback = '::';
try {
$callback();
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Test string ending in single colon
$callback = 'Class:';
try {
$callback();
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Test string beginning in single colon
$callback = ':method';
try {
$callback();
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Test single colon
$callback = ':';
try {
$callback();
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
string(0) ""
string(0) ""
-Class "" not found
-Class "" not found
-Class "" not found
-Class "" not found
-Call to undefined function Class:()
-Call to undefined function :method()
-Call to undefined function :()
+Error: Class "" not found
+Error: Class "" not found
+Error: Class "" not found
+Error: Class "" not found
+Error: Call to undefined function Class:()
+Error: Call to undefined function :method()
+Error: Call to undefined function :()
diff --git a/Zend/tests/indirect_function_call/indirect_method_call_001.phpt b/Zend/tests/indirect_function_call/indirect_method_call_001.phpt
index 39967fdb267..394e0277919 100644
--- a/Zend/tests/indirect_function_call/indirect_method_call_001.phpt
+++ b/Zend/tests/indirect_function_call/indirect_method_call_001.phpt
@@ -11,10 +11,10 @@ public function __construct() {
try {
$X = (new foo)->Inexistent(3);
-} catch (Exception $e) {
- var_dump($e->getMessage()); // foobar
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n"; // foobar
}
?>
--EXPECT--
-string(6) "foobar"
+Exception: foobar
diff --git a/Zend/tests/init_array_illegal_offset_type.phpt b/Zend/tests/init_array_illegal_offset_type.phpt
index ee41c0217ad..a7575fe1554 100644
--- a/Zend/tests/init_array_illegal_offset_type.phpt
+++ b/Zend/tests/init_array_illegal_offset_type.phpt
@@ -7,9 +7,9 @@ function test() {
}
try {
test();
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot access offset of type stdClass on array
+TypeError: Cannot access offset of type stdClass on array
diff --git a/Zend/tests/int_static_prop_name.phpt b/Zend/tests/int_static_prop_name.phpt
index e29e2514bb9..27a3c521aa5 100644
--- a/Zend/tests/int_static_prop_name.phpt
+++ b/Zend/tests/int_static_prop_name.phpt
@@ -16,20 +16,20 @@ class Foo {
try {
var_dump(Foo::${42});
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(Foo::${(int) 42});
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(Foo::${(int) $n});
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -37,6 +37,6 @@ class Foo {
int(24)
int(24)
int(24)
-Access to undeclared static property Foo::$42
-Access to undeclared static property Foo::$42
-Access to undeclared static property Foo::$42
+Error: Access to undeclared static property Foo::$42
+Error: Access to undeclared static property Foo::$42
+Error: Access to undeclared static property Foo::$42
diff --git a/Zend/tests/invalid_parent_const_ref_leak.phpt b/Zend/tests/invalid_parent_const_ref_leak.phpt
index ed728f7d45e..cf102c14e98 100644
--- a/Zend/tests/invalid_parent_const_ref_leak.phpt
+++ b/Zend/tests/invalid_parent_const_ref_leak.phpt
@@ -9,10 +9,10 @@ class A {
try {
A::B;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot access "parent" when current class scope has no parent
+Error: Cannot access "parent" when current class scope has no parent
diff --git a/Zend/tests/isset/isset_array.phpt b/Zend/tests/isset/isset_array.phpt
index 48e908a36d5..f74498b7c47 100644
--- a/Zend/tests/isset/isset_array.phpt
+++ b/Zend/tests/isset/isset_array.phpt
@@ -24,14 +24,14 @@
try {
isset($array[[]]);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
isset($array[new stdClass()]);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECTF--
@@ -48,5 +48,5 @@
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
bool(false)
-Cannot access offset of type array in isset or empty
-Cannot access offset of type stdClass in isset or empty
+TypeError: Cannot access offset of type array in isset or empty
+TypeError: Cannot access offset of type stdClass in isset or empty
diff --git a/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt b/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt
index c4675671864..15cf5fdad65 100644
--- a/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt
+++ b/Zend/tests/lazy_objects/rfc/rfc_example_006.phpt
@@ -32,8 +32,8 @@ class MyClass {
try {
var_dump($object1->propB);
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// The state of both objects is unchanged
@@ -52,7 +52,7 @@ class MyClass {
["propA"]=>
string(8) "object-2"
}
-initializer exception
+Exception: initializer exception
lazy ghost object(MyClass)#%d (1) {
["propA"]=>
string(8) "object-1"
diff --git a/Zend/tests/lazy_objects/typed_properties_001.phpt b/Zend/tests/lazy_objects/typed_properties_001.phpt
index 1f457531d87..06b7689900b 100644
--- a/Zend/tests/lazy_objects/typed_properties_001.phpt
+++ b/Zend/tests/lazy_objects/typed_properties_001.phpt
@@ -20,14 +20,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);
?>
--EXPECTF--
-Cannot assign string to property Test::$prop of type int
+TypeError: Cannot assign string to property Test::$prop of type int
lazy proxy object(Test)#%d (1) {
["instance"]=>
object(Test)#%d (0) {
diff --git a/Zend/tests/live_range_phi_leak.phpt b/Zend/tests/live_range_phi_leak.phpt
index f0725840530..d5d70f0a3c1 100644
--- a/Zend/tests/live_range_phi_leak.phpt
+++ b/Zend/tests/live_range_phi_leak.phpt
@@ -11,9 +11,9 @@ function test($k) {
}
try {
test(new stdClass);
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Test
+Exception: Test
diff --git a/Zend/tests/magic_methods/bug26166.phpt b/Zend/tests/magic_methods/bug26166.phpt
index 3e5c6daa21d..7e1c4879080 100644
--- a/Zend/tests/magic_methods/bug26166.phpt
+++ b/Zend/tests/magic_methods/bug26166.phpt
@@ -40,8 +40,8 @@ function __toString() {
$o = new NoneTest;
try {
echo $o;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "===THROW===\n";
@@ -56,14 +56,14 @@ function __toString() {
$o = new ErrorTest;
try {
echo $o;
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
Hello World!
===NONE===
-NoneTest::__toString(): Return value must be of type string, none returned
+TypeError: NoneTest::__toString(): Return value must be of type string, none returned
===THROW===
-This is an error!
+Exception: This is an error!
diff --git a/Zend/tests/magic_methods/bug29368_2.phpt b/Zend/tests/magic_methods/bug29368_2.phpt
index e13d6da8846..fda92130c50 100644
--- a/Zend/tests/magic_methods/bug29368_2.phpt
+++ b/Zend/tests/magic_methods/bug29368_2.phpt
@@ -12,10 +12,10 @@ function __destruct() {
try {
$x = new ReflectionMethod(new Bomb(), "foo");
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "ok\n";
?>
--EXPECT--
-bomb!
+Exception: bomb!
ok
diff --git a/Zend/tests/magic_methods/bug45186.phpt b/Zend/tests/magic_methods/bug45186.phpt
index 9e0078d7700..6722ea39718 100644
--- a/Zend/tests/magic_methods/bug45186.phpt
+++ b/Zend/tests/magic_methods/bug45186.phpt
@@ -33,8 +33,8 @@ static function x() {
call_user_func('BAR::www');
try {
call_user_func('self::y');
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -58,4 +58,4 @@ static function x() {
ok
__callstatic:
string(3) "www"
-call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active
+TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active
diff --git a/Zend/tests/magic_methods/bug45186_2.phpt b/Zend/tests/magic_methods/bug45186_2.phpt
index e85528ce8b0..bea4427ade4 100644
--- a/Zend/tests/magic_methods/bug45186_2.phpt
+++ b/Zend/tests/magic_methods/bug45186_2.phpt
@@ -28,13 +28,13 @@ static function x() {
call_user_func(array('BAR','x'));
try {
call_user_func('BAR::www');
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
call_user_func('self::y');
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -56,5 +56,5 @@ static function x() {
__call:
string(1) "y"
ok
-call_user_func(): Argument #1 ($callback) must be a valid callback, class bar does not have a method "www"
-call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active
+TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, class bar does not have a method "www"
+TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active
diff --git a/Zend/tests/magic_methods/bug76667.phpt b/Zend/tests/magic_methods/bug76667.phpt
index 03bd490a040..d27ea5e18d5 100644
--- a/Zend/tests/magic_methods/bug76667.phpt
+++ b/Zend/tests/magic_methods/bug76667.phpt
@@ -18,12 +18,12 @@ public function __set($k, $v)
$x = new T;
try {
$x->x = 1;
-} catch (\DivisionByZeroError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Undefined variable $undefined in %s on line %d
Warning: Attempt to read property "1" on null in %s on line %d
-Division by zero
+DivisionByZeroError: Division by zero
diff --git a/Zend/tests/match/043.phpt b/Zend/tests/match/043.phpt
index 03ff0cbf36d..32ec8bcac38 100644
--- a/Zend/tests/match/043.phpt
+++ b/Zend/tests/match/043.phpt
@@ -8,8 +8,8 @@ class Beep {}
function test(mixed $var) {
try {
match($var) {};
- } catch (UnhandledMatchError $e) {
- print $e->getMessage() . PHP_EOL;
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -27,14 +27,14 @@ function test(mixed $var) {
test(str_repeat("e\n", 100));
?>
--EXPECT--
-Unhandled match case NULL
-Unhandled match case 1
-Unhandled match case 5.5
-Unhandled match case 5.0
-Unhandled match case 'foo'
-Unhandled match case true
-Unhandled match case false
-Unhandled match case of type array
-Unhandled match case of type Beep
-Unhandled match case 'eeeeeeeeeeeeeee...'
-Unhandled match case 'e\ne\ne\ne\ne\ne\ne\ne...'
+UnhandledMatchError: Unhandled match case NULL
+UnhandledMatchError: Unhandled match case 1
+UnhandledMatchError: Unhandled match case 5.5
+UnhandledMatchError: Unhandled match case 5.0
+UnhandledMatchError: Unhandled match case 'foo'
+UnhandledMatchError: Unhandled match case true
+UnhandledMatchError: Unhandled match case false
+UnhandledMatchError: Unhandled match case of type array
+UnhandledMatchError: Unhandled match case of type Beep
+UnhandledMatchError: Unhandled match case 'eeeeeeeeeeeeeee...'
+UnhandledMatchError: Unhandled match case 'e\ne\ne\ne\ne\ne\ne\ne...'
diff --git a/Zend/tests/match/045.phpt b/Zend/tests/match/045.phpt
index da8991cf595..77b6e58d7a3 100644
--- a/Zend/tests/match/045.phpt
+++ b/Zend/tests/match/045.phpt
@@ -10,9 +10,9 @@ function test() {
}
try {
test();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Undefined constant "x"
+Error: Undefined constant "x"
diff --git a/Zend/tests/match/048.phpt b/Zend/tests/match/048.phpt
index e5c6bb2e0bc..008b83fbc1a 100644
--- a/Zend/tests/match/048.phpt
+++ b/Zend/tests/match/048.phpt
@@ -10,8 +10,8 @@ class Beep {}
function test(mixed $var) {
try {
match($var) {};
- } catch (UnhandledMatchError $e) {
- print $e->getMessage() . PHP_EOL;
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -29,14 +29,14 @@ function test(mixed $var) {
test(str_repeat("e\n", 100));
?>
--EXPECT--
-Unhandled match case NULL
-Unhandled match case 1
-Unhandled match case 5.5
-Unhandled match case 5.0
-Unhandled match case of type string
-Unhandled match case true
-Unhandled match case false
-Unhandled match case of type array
-Unhandled match case of type Beep
-Unhandled match case of type string
-Unhandled match case of type string
+UnhandledMatchError: Unhandled match case NULL
+UnhandledMatchError: Unhandled match case 1
+UnhandledMatchError: Unhandled match case 5.5
+UnhandledMatchError: Unhandled match case 5.0
+UnhandledMatchError: Unhandled match case of type string
+UnhandledMatchError: Unhandled match case true
+UnhandledMatchError: Unhandled match case false
+UnhandledMatchError: Unhandled match case of type array
+UnhandledMatchError: Unhandled match case of type Beep
+UnhandledMatchError: Unhandled match case of type string
+UnhandledMatchError: Unhandled match case of type string
diff --git a/Zend/tests/match/049.phpt b/Zend/tests/match/049.phpt
index 2a2385f704f..23933003d5b 100644
--- a/Zend/tests/match/049.phpt
+++ b/Zend/tests/match/049.phpt
@@ -10,8 +10,8 @@ class Beep {}
function test(mixed $var) {
try {
match($var) {};
- } catch (UnhandledMatchError $e) {
- print $e->getMessage() . PHP_EOL;
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -29,14 +29,14 @@ function test(mixed $var) {
test(str_repeat("e\n", 100));
?>
--EXPECT--
-Unhandled match case of type null
-Unhandled match case of type int
-Unhandled match case of type float
-Unhandled match case of type float
-Unhandled match case of type string
-Unhandled match case of type bool
-Unhandled match case of type bool
-Unhandled match case of type array
-Unhandled match case of type Beep
-Unhandled match case of type string
-Unhandled match case of type string
+UnhandledMatchError: Unhandled match case of type null
+UnhandledMatchError: Unhandled match case of type int
+UnhandledMatchError: Unhandled match case of type float
+UnhandledMatchError: Unhandled match case of type float
+UnhandledMatchError: Unhandled match case of type string
+UnhandledMatchError: Unhandled match case of type bool
+UnhandledMatchError: Unhandled match case of type bool
+UnhandledMatchError: Unhandled match case of type array
+UnhandledMatchError: Unhandled match case of type Beep
+UnhandledMatchError: Unhandled match case of type string
+UnhandledMatchError: Unhandled match case of type string
diff --git a/Zend/tests/match/unmatched_enum.phpt b/Zend/tests/match/unmatched_enum.phpt
index 93f368a316b..e3238f03493 100644
--- a/Zend/tests/match/unmatched_enum.phpt
+++ b/Zend/tests/match/unmatched_enum.phpt
@@ -12,10 +12,10 @@ enum Foo {
match (Foo::Bar) {
Foo::Baz => 42,
};
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Unhandled match case Foo::Bar
+UnhandledMatchError: Unhandled match case Foo::Bar
diff --git a/Zend/tests/methods-on-non-objects-call-user-func.phpt b/Zend/tests/methods-on-non-objects-call-user-func.phpt
index 7a8ab5a2647..4463d97263a 100644
--- a/Zend/tests/methods-on-non-objects-call-user-func.phpt
+++ b/Zend/tests/methods-on-non-objects-call-user-func.phpt
@@ -5,9 +5,9 @@
$comparator = null;
try {
var_dump(call_user_func([$comparator, 'compare'], 1, 2));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
+TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
diff --git a/Zend/tests/methods-on-non-objects-catch.phpt b/Zend/tests/methods-on-non-objects-catch.phpt
index b090437084f..5e7c02e7a1c 100644
--- a/Zend/tests/methods-on-non-objects-catch.phpt
+++ b/Zend/tests/methods-on-non-objects-catch.phpt
@@ -9,12 +9,11 @@
$x= null;
try {
var_dump($x->method());
-} catch (Error $e) {
- var_dump($e->getCode(), $e->getMessage());
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getCode(), ': ', $e->getMessage(), "\n";
}
echo "Alive\n";
?>
--EXPECTF--
-int(0)
-string(%d) "Call to a member function method() on null"
+Error: 0: Call to a member function method() on null
Alive
diff --git a/Zend/tests/methods-on-non-objects-usort.phpt b/Zend/tests/methods-on-non-objects-usort.phpt
index 8a89023b7e8..5f3306d5bce 100644
--- a/Zend/tests/methods-on-non-objects-usort.phpt
+++ b/Zend/tests/methods-on-non-objects-usort.phpt
@@ -11,8 +11,8 @@
usort($list, function($a, $b) use ($comparator) {
try {
return $comparator->compare($a, $b);
- } catch (Error $e) {
- var_dump($e->getCode(), $e->getMessage());
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getCode(), ': ', $e->getMessage(), "\n";
return 0;
}
});
@@ -20,14 +20,10 @@
echo "Alive\n";
?>
--EXPECT--
-int(0)
-string(43) "Call to a member function compare() on null"
-int(0)
-string(43) "Call to a member function compare() on null"
-int(0)
-string(43) "Call to a member function compare() on null"
-int(0)
-string(43) "Call to a member function compare() on null"
+Error: 0: Call to a member function compare() on null
+Error: 0: Call to a member function compare() on null
+Error: 0: Call to a member function compare() on null
+Error: 0: Call to a member function compare() on null
array(5) {
[0]=>
int(1)
diff --git a/Zend/tests/mod_001.phpt b/Zend/tests/mod_001.phpt
index 5c543a26192..a836044df9a 100644
--- a/Zend/tests/mod_001.phpt
+++ b/Zend/tests/mod_001.phpt
@@ -9,12 +9,12 @@
try {
$c = $a % $b;
var_dump($c);
-} catch (TypeError $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types: array % array
+TypeError: Unsupported operand types: array % array
Done
diff --git a/Zend/tests/mul_001.phpt b/Zend/tests/mul_001.phpt
index ddb65768530..fee2d0c9c62 100644
--- a/Zend/tests/mul_001.phpt
+++ b/Zend/tests/mul_001.phpt
@@ -8,8 +8,8 @@
try {
var_dump($a * $b);
-} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$c = $a * $b;
@@ -18,7 +18,7 @@
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types: array * array
+TypeError: Unsupported operand types: array * array
Fatal error: Uncaught TypeError: Unsupported operand types: array * array in %s:%d
Stack trace:
diff --git a/Zend/tests/named_params/__invoke.phpt b/Zend/tests/named_params/__invoke.phpt
index 6ebbac0f07f..717ad657380 100644
--- a/Zend/tests/named_params/__invoke.phpt
+++ b/Zend/tests/named_params/__invoke.phpt
@@ -21,8 +21,8 @@ public function __invoke($a = 'a', $b = 'b', ...$rest) {
$test(b: 'B');
try {
$test(b: 'B', c: 'C');
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -38,15 +38,15 @@ public function __invoke($a = 'a', $b = 'b', ...$rest) {
$test3(b: 'B');
try {
$test3(b: 'B', c: 'C');
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
a: A, b: B
a: a, b: B
-Unknown named parameter $c
+Error: Unknown named parameter $c
a: A, b: B
array(1) {
@@ -61,4 +61,4 @@ public function __invoke($a = 'a', $b = 'b', ...$rest) {
a: A, b: B
a: a, b: B
-Unknown named parameter $c
+Error: Unknown named parameter $c
diff --git a/Zend/tests/named_params/assert.phpt b/Zend/tests/named_params/assert.phpt
index 40a92a2f1fe..58ba7605a37 100644
--- a/Zend/tests/named_params/assert.phpt
+++ b/Zend/tests/named_params/assert.phpt
@@ -6,25 +6,25 @@
assert(assertion: true);
try {
assert(assertion: false);
-} catch (AssertionError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
assert(assertion: true, description: "Description");
try {
assert(assertion: false, description: "Description");
-} catch (AssertionError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(description: "Description");
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(assertion: false)
-Description
-Named parameter $description overwrites previous argument
+AssertionError: assert(assertion: false)
+AssertionError: Description
+Error: Named parameter $description overwrites previous argument
diff --git a/Zend/tests/named_params/attributes.phpt b/Zend/tests/named_params/attributes.phpt
index 94d2fad19f4..caee975632a 100644
--- a/Zend/tests/named_params/attributes.phpt
+++ b/Zend/tests/named_params/attributes.phpt
@@ -26,8 +26,8 @@ class Test2 {}
$attr = (new ReflectionClass(Test2::class))->getAttributes()[0];
try {
var_dump($attr->newInstance());
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -47,4 +47,4 @@ class Test2 {}
["c"]=>
string(1) "C"
}
-Named parameter $a overwrites previous argument
+Error: Named parameter $a overwrites previous argument
diff --git a/Zend/tests/named_params/call_user_func.phpt b/Zend/tests/named_params/call_user_func.phpt
index 50f2ed588e9..74b6e6707a1 100644
--- a/Zend/tests/named_params/call_user_func.phpt
+++ b/Zend/tests/named_params/call_user_func.phpt
@@ -36,18 +36,18 @@ public function method($a = 'a', $b = 'b', $c = 'c') {
var_dump(call_user_func('call_user_func', $test, c: 'D'));
try {
call_user_func($test_required, b: 'B');
-} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(call_user_func('array_slice', [1, 2, 3, 4, 5], length: 2));
-} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(call_user_func('array_slice', [1, 2, 3, 4, 'x' => 5], 3, preserve_keys: true));
-} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -82,8 +82,8 @@ public function method($a = 'a', $b = 'b', $c = 'c') {
Warning: {closure:%s:%d}(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
a = a, b = b, c = D
NULL
-{closure:%s:%d}(): Argument #1 ($a) not passed
-array_slice(): Argument #2 ($offset) not passed
+ArgumentCountError: {closure:%s:%d}(): Argument #1 ($a) not passed
+ArgumentCountError: array_slice(): Argument #2 ($offset) not passed
array(2) {
[3]=>
int(4)
diff --git a/Zend/tests/named_params/call_user_func_array.phpt b/Zend/tests/named_params/call_user_func_array.phpt
index ebee06ea6af..b708c63ad80 100644
--- a/Zend/tests/named_params/call_user_func_array.phpt
+++ b/Zend/tests/named_params/call_user_func_array.phpt
@@ -17,13 +17,13 @@
call_user_func_array($test_variadic, ['A', 'c' => 'C']);
try {
call_user_func_array($test, ['d' => 'D']);
- } catch (\Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
call_user_func_array($test, ['c' => 'C', 'A']);
- } catch (\Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
}
@@ -35,13 +35,13 @@
call_user_func_array($test_variadic, ['A', 'c' => 'C']);
try {
call_user_func_array($test, ['d' => 'D']);
- } catch (\Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
call_user_func_array($test, ['c' => 'C', 'A']);
- } catch (\Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -56,8 +56,8 @@
["c"]=>
string(1) "C"
}
-Unknown named parameter $d
-Cannot use positional argument after named argument
+Error: Unknown named parameter $d
+Error: Cannot use positional argument after named argument
a = A, b = B, c = c
a = A, b = B, c = c
@@ -68,5 +68,5 @@
["c"]=>
string(1) "C"
}
-Unknown named parameter $d
-Cannot use positional argument after named argument
+Error: Unknown named parameter $d
+Error: Cannot use positional argument after named argument