[PHP-CVS] [php-src] master: Zend: applied fixers to improve test robustness (part 1/8) (#23308)
[email protected] (NickSdot via GitHub)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: NickSdot (NickSdot)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-08-22T14:11:35+01:00
Commit: https://github.com/php/php-src/commit/bd044a29bf1664625db030f4179ef54a8db53082
Raw diff: https://github.com/php/php-src/commit/bd044a29bf1664625db030f4179ef54a8db53082.diff
Zend: applied fixers to improve test robustness (part 1/8) (#23308)
Changed paths:
M Zend/tests/access_modifiers/access_modifiers_008.phpt
M Zend/tests/add_002.phpt
M Zend/tests/add_003.phpt
M Zend/tests/add_004.phpt
M Zend/tests/add_006.phpt
M Zend/tests/add_007.phpt
M Zend/tests/arg_unpack/invalid_type.phpt
M Zend/tests/arg_unpack/non_integer_keys.phpt
M Zend/tests/arg_unpack/string_keys.phpt
M Zend/tests/arg_unpack/traversable_throwing_exception.phpt
M Zend/tests/array_literal_next_element_error.phpt
M Zend/tests/array_merge_recursive_next_key_overflow.phpt
M Zend/tests/array_unpack/already_occupied.phpt
M Zend/tests/array_unpack/classes.phpt
M Zend/tests/array_unpack/non_integer_keys.phpt
M Zend/tests/arrow_functions/006.phpt
M Zend/tests/arrow_functions/007.phpt
M Zend/tests/arrow_functions/gh7900.phpt
M Zend/tests/assert/bug70528.phpt
M Zend/tests/assert/bug71922.phpt
M Zend/tests/assert/expect_003.phpt
M Zend/tests/assert/expect_004.phpt
M Zend/tests/assert/expect_005.phpt
M Zend/tests/assert/expect_015.phpt
M Zend/tests/assert/expect_016.phpt
M Zend/tests/assert/expect_018.phpt
M Zend/tests/assign_dim_obj_null_return.phpt
M Zend/tests/assign_op_type_error.phpt
M Zend/tests/assign_property_null_object.phpt
M Zend/tests/assign_ref_error_var_handling.phpt
M Zend/tests/assign_to_obj_002.phpt
M Zend/tests/ast/ast_serialize_backtick_literal.phpt
M Zend/tests/ast/ast_serialize_floats.phpt
M Zend/tests/ast/gh21072.phpt
M Zend/tests/ast/zend-pow-assign.phpt
M Zend/tests/asymmetric_visibility/__set.phpt
M Zend/tests/asymmetric_visibility/__unset.phpt
M Zend/tests/asymmetric_visibility/ast_printing.phpt
M Zend/tests/asymmetric_visibility/bug001.phpt
M Zend/tests/asymmetric_visibility/bug002.phpt
M Zend/tests/asymmetric_visibility/bug003.phpt
M Zend/tests/asymmetric_visibility/cpp_private.phpt
M Zend/tests/asymmetric_visibility/cpp_protected.phpt
M Zend/tests/asymmetric_visibility/dim_add.phpt
M Zend/tests/asymmetric_visibility/optimizer_shared_cache_slot.phpt
M Zend/tests/asymmetric_visibility/private.phpt
M Zend/tests/asymmetric_visibility/protected.phpt
M Zend/tests/asymmetric_visibility/readonly.phpt
M Zend/tests/asymmetric_visibility/reference.phpt
M Zend/tests/asymmetric_visibility/reference_2.phpt
M Zend/tests/asymmetric_visibility/scope_rebinding.phpt
M Zend/tests/asymmetric_visibility/static_props.phpt
M Zend/tests/asymmetric_visibility/unset.phpt
M Zend/tests/asymmetric_visibility/unshared_rw_cache_slot.phpt
M Zend/tests/attributes/003_ast_nodes.phpt
M Zend/tests/attributes/005_objects.phpt
M Zend/tests/attributes/006_filter.phpt
M Zend/tests/attributes/013_class_scope.phpt
M Zend/tests/attributes/020_userland_attribute_validation.phpt
M Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt
M Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt
M Zend/tests/attributes/023_ast_node_in_validation.phpt
M Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt
M Zend/tests/attributes/delayed_target_validation/opcache_validator_errors.phpt
M Zend/tests/attributes/delayed_target_validation/validator_AllowDynamicProperties.phpt
M Zend/tests/attributes/delayed_target_validation/validator_Attribute.phpt
M Zend/tests/attributes/delayed_target_validation/validator_Deprecated.phpt
M Zend/tests/attributes/delayed_target_validation/validator_NoDiscard.phpt
M Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt
M Zend/tests/attributes/deprecated/constants/const_messages.phpt
M Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt
M Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt
M Zend/tests/attributes/deprecated/functions/throwing_error_handler_002.phpt
M Zend/tests/attributes/deprecated/functions/throwing_error_handler_003.phpt
M Zend/tests/attributes/nodiscard/002.phpt
M Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt
M Zend/tests/attributes/ossfuzz371445205.phpt
M Zend/tests/backtrace/debug_print_backtrace_from_main.phpt
M Zend/tests/bind_static_exception.phpt
M Zend/tests/bitwise_not_precision_exception.phpt
M Zend/tests/bug26229.phpt
M Zend/tests/bug31098.phpt
M Zend/tests/bug31720.phpt
M Zend/tests/bug33996.phpt
M Zend/tests/bug37811.phpt
M Zend/tests/bug44660.phpt
M Zend/tests/bug46106.phpt
Diff:
diff --git a/Zend/tests/access_modifiers/access_modifiers_008.phpt b/Zend/tests/access_modifiers/access_modifiers_008.phpt
index 1cce8767d850..57c555bb6345 100644
--- a/Zend/tests/access_modifiers/access_modifiers_008.phpt
+++ b/Zend/tests/access_modifiers/access_modifiers_008.phpt
@@ -33,18 +33,18 @@ class B2 extends A {
try {
echo A::mp() . "\n";
} catch (\Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo B1::ma() . "\n"; // protected method defined also in A
try {
echo B1::mp() . "\n"; // protected method defined also in A but as private
} catch (\Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
echo B1::mb() . "\n";
} catch (\Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
}
@@ -54,7 +54,7 @@ B2::test();
?>
--EXPECT--
A::ma()
-Call to private method A::mp() from scope B2
+Error: Call to private method A::mp() from scope B2
B1::ma()
-Call to protected method B1::mp() from scope B2
-Call to protected method B1::mb() from scope B2
+Error: Call to protected method B1::mp() from scope B2
+Error: Call to protected method B1::mb() from scope B2
diff --git a/Zend/tests/add_002.phpt b/Zend/tests/add_002.phpt
index 9077ece08587..627e210d0f17 100644
--- a/Zend/tests/add_002.phpt
+++ b/Zend/tests/add_002.phpt
@@ -10,8 +10,8 @@ $o->prop = "value";
try {
var_dump($a + $o);
-} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$c = $a + $o;
@@ -20,7 +20,7 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types: array + stdClass
+TypeError: Unsupported operand types: array + stdClass
Fatal error: Uncaught TypeError: Unsupported operand types: array + stdClass in %s:%d
Stack trace:
diff --git a/Zend/tests/add_003.phpt b/Zend/tests/add_003.phpt
index 6d27863e893f..6472a050bf9d 100644
--- a/Zend/tests/add_003.phpt
+++ b/Zend/tests/add_003.phpt
@@ -10,8 +10,8 @@ $o->prop = "value";
try {
var_dump($o + $a);
-} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$c = $o + $a;
@@ -20,7 +20,7 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types: stdClass + array
+TypeError: Unsupported operand types: stdClass + array
Fatal error: Uncaught TypeError: Unsupported operand types: stdClass + array in %s:%d
Stack trace:
diff --git a/Zend/tests/add_004.phpt b/Zend/tests/add_004.phpt
index 2f16f10eaf50..dbdd26cad75a 100644
--- a/Zend/tests/add_004.phpt
+++ b/Zend/tests/add_004.phpt
@@ -7,8 +7,8 @@ $a = array(1,2,3);
try {
var_dump($a + 5);
-} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$c = $a + 5;
@@ -17,7 +17,7 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types: array + int
+TypeError: Unsupported operand types: array + int
Fatal error: Uncaught TypeError: Unsupported operand types: array + int in %s:%d
Stack trace:
diff --git a/Zend/tests/add_006.phpt b/Zend/tests/add_006.phpt
index 09945f3fce6c..f51397cbec7c 100644
--- a/Zend/tests/add_006.phpt
+++ b/Zend/tests/add_006.phpt
@@ -14,8 +14,8 @@ $s4 = "25.68";
try {
$c = $i + $s1;
var_dump($c);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$c = $i + $s2;
var_dump($c);
@@ -29,8 +29,8 @@ var_dump($c);
try {
$c = $s1 + $i;
var_dump($c);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$c = $s2 + $i;
@@ -45,13 +45,13 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Unsupported operand types: int + string
+TypeError: Unsupported operand types: int + string
Warning: A non-numeric value encountered in %s on line %d
int(951858)
int(48550510)
float(75661.68)
-Unsupported operand types: string + int
+TypeError: Unsupported operand types: string + int
Warning: A non-numeric value encountered in %s on line %d
int(951858)
diff --git a/Zend/tests/add_007.phpt b/Zend/tests/add_007.phpt
index a2beddfaed41..fb3d5522d5f5 100644
--- a/Zend/tests/add_007.phpt
+++ b/Zend/tests/add_007.phpt
@@ -9,8 +9,8 @@ $s1 = "some string";
try {
var_dump($a + $s1);
-} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$c = $a + $s1;
@@ -19,7 +19,7 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types: array + string
+TypeError: Unsupported operand types: array + string
Fatal error: Uncaught TypeError: Unsupported operand types: array + string in %s:%d
Stack trace:
diff --git a/Zend/tests/arg_unpack/invalid_type.phpt b/Zend/tests/arg_unpack/invalid_type.phpt
index a0e649371528..32c624eee2d3 100644
--- a/Zend/tests/arg_unpack/invalid_type.phpt
+++ b/Zend/tests/arg_unpack/invalid_type.phpt
@@ -9,29 +9,29 @@ function test(...$args) {
try {
test(...null);
-} catch (Error $e) {
- echo $e::class . ": " . $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(...42);
-} catch (Error $e) {
- echo $e::class . ": " . $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(...new stdClass);
-} catch (Error $e) {
- echo $e::class . ": " . $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(1, 2, 3, ..."foo", ...[4, 5]);
-} catch (Error $e) {
- echo $e::class . ": " . $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(1, 2, 3, ...new StdClass, ...3.14, ...[4, 5]);
-} catch (Error $e) {
- echo $e::class . ": " . $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
diff --git a/Zend/tests/arg_unpack/non_integer_keys.phpt b/Zend/tests/arg_unpack/non_integer_keys.phpt
index 88e1747df9c3..daf7d3c58a76 100644
--- a/Zend/tests/arg_unpack/non_integer_keys.phpt
+++ b/Zend/tests/arg_unpack/non_integer_keys.phpt
@@ -12,10 +12,10 @@ function gen() {
try {
foo(...gen());
-} catch (Error $ex) {
- echo "Exception: " . $ex->getMessage() . "\n";
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
-Exception: Keys must be of type int|string during argument unpacking
+Error: Keys must be of type int|string during argument unpacking
diff --git a/Zend/tests/arg_unpack/string_keys.phpt b/Zend/tests/arg_unpack/string_keys.phpt
index b0bf366fb38d..3d1d1c866d58 100644
--- a/Zend/tests/arg_unpack/string_keys.phpt
+++ b/Zend/tests/arg_unpack/string_keys.phpt
@@ -9,10 +9,10 @@ set_error_handler(function($errno, $errstr) {
try {
var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
-} catch (Error $ex) {
- var_dump($ex->getMessage());
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
-string(68) "Cannot use positional argument after named argument during unpacking"
+Error: Cannot use positional argument after named argument during unpacking
diff --git a/Zend/tests/arg_unpack/traversable_throwing_exception.phpt b/Zend/tests/arg_unpack/traversable_throwing_exception.phpt
index c78e491e2015..25c5da8df29d 100644
--- a/Zend/tests/arg_unpack/traversable_throwing_exception.phpt
+++ b/Zend/tests/arg_unpack/traversable_throwing_exception.phpt
@@ -21,13 +21,13 @@ function gen() {
try {
test(1, 2, ...new Foo, ...[3, 4]);
-} catch (Exception $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
try {
test(1, 2, ...gen(), ...[3, 4]);
-} catch (Exception $e) { var_dump($e->getMessage()); }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
?>
--EXPECT--
-string(11) "getIterator"
-string(3) "gen"
+Exception: getIterator
+Exception: gen
diff --git a/Zend/tests/array_literal_next_element_error.phpt b/Zend/tests/array_literal_next_element_error.phpt
index 23dec5e22cae..33ce9e7c35b3 100644
--- a/Zend/tests/array_literal_next_element_error.phpt
+++ b/Zend/tests/array_literal_next_element_error.phpt
@@ -7,18 +7,18 @@ $i = PHP_INT_MAX;
try {
$array = [$i => 42, new stdClass];
var_dump($array);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
function test($x = [PHP_INT_MAX => 42, "foo"]) {}
try {
test();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot add element to the array as the next element is already occupied
-Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
diff --git a/Zend/tests/array_merge_recursive_next_key_overflow.phpt b/Zend/tests/array_merge_recursive_next_key_overflow.phpt
index f7d287295783..492d06973b49 100644
--- a/Zend/tests/array_merge_recursive_next_key_overflow.phpt
+++ b/Zend/tests/array_merge_recursive_next_key_overflow.phpt
@@ -8,7 +8,7 @@ try {
['' => [null]],
);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
@@ -17,9 +17,9 @@ try {
['foo' => str_repeat('a', 2)],
);
} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot add element to the array as the next element is already occupied
-Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
diff --git a/Zend/tests/array_unpack/already_occupied.phpt b/Zend/tests/array_unpack/already_occupied.phpt
index b2febe002156..3f031c082f95 100644
--- a/Zend/tests/array_unpack/already_occupied.phpt
+++ b/Zend/tests/array_unpack/already_occupied.phpt
@@ -8,26 +8,26 @@ Appending to an array via unpack may fail
$arr = [1, 2, 3];
try {
var_dump([PHP_INT_MAX-1 => 0, ...$arr]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
const ARR = [1, 2, 3];
function test($x = [PHP_INT_MAX-1 => 0, ...ARR]) {}
try {
test();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot add element to the array as the next element is already occupied
-Cannot add element to the array as the next element is already occupied
-Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
diff --git a/Zend/tests/array_unpack/classes.phpt b/Zend/tests/array_unpack/classes.phpt
index fa4b0f8e536f..7a1f95552338 100644
--- a/Zend/tests/array_unpack/classes.phpt
+++ b/Zend/tests/array_unpack/classes.phpt
@@ -19,8 +19,8 @@ var_dump(C::$bar);
try {
var_dump(D::A);
-} catch (Error $ex) {
- echo "Exception: " . $ex->getMessage() . "\n";
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
@@ -44,4 +44,4 @@ array(3) {
[2]=>
int(3)
}
-Exception: Cannot declare self-referencing constant self::B
+Error: Cannot declare self-referencing constant self::B
diff --git a/Zend/tests/array_unpack/non_integer_keys.phpt b/Zend/tests/array_unpack/non_integer_keys.phpt
index ab7a20ac86b9..099a928ffdd7 100644
--- a/Zend/tests/array_unpack/non_integer_keys.phpt
+++ b/Zend/tests/array_unpack/non_integer_keys.phpt
@@ -9,10 +9,10 @@ function gen() {
try {
[...gen()];
-} catch (Error $ex) {
- echo "Exception: " . $ex->getMessage() . "\n";
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
-Exception: 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/arrow_functions/006.phpt b/Zend/tests/arrow_functions/006.phpt
index 6f61b3c817d9..15e1d18d7e0f 100644
--- a/Zend/tests/arrow_functions/006.phpt
+++ b/Zend/tests/arrow_functions/006.phpt
@@ -16,23 +16,23 @@ $int_fn = fn(int $x): int => $x;
var_dump($int_fn($var));
try {
$int_fn("foo");
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$varargs = fn(?int... $args): array => $args;
var_dump($varargs(20, null, 30));
try {
$varargs(40, "foo");
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
int(2)
int(10)
-{closure:%s:%d}(): Argument #1 ($x) must be of type int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($x) must be of type int, string given, called in %s on line %d
array(3) {
[0]=>
int(20)
@@ -41,4 +41,4 @@ array(3) {
[2]=>
int(30)
}
-{closure:%s:%d}(): Argument #2 must be of type ?int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #2 must be of type ?int, string given, called in %s on line %d
diff --git a/Zend/tests/arrow_functions/007.phpt b/Zend/tests/arrow_functions/007.phpt
index 66b03b84c2e9..7b63b1ba1520 100644
--- a/Zend/tests/arrow_functions/007.phpt
+++ b/Zend/tests/arrow_functions/007.phpt
@@ -7,17 +7,17 @@ zend.assertions=1
try {
assert((fn() => false)());
-} catch (AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert((fn&(int... $args): ?bool => $args[0])(false));
-} catch (AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(): assert((fn() => false)()) failed
-assert(): assert((fn&(int ...$args): ?bool => $args[0])(false)) failed
+AssertionError: assert((fn() => false)())
+AssertionError: assert((fn&(int ...$args): ?bool => $args[0])(false))
diff --git a/Zend/tests/arrow_functions/gh7900.phpt b/Zend/tests/arrow_functions/gh7900.phpt
index d6465c312399..cfe09ba6cc4c 100644
--- a/Zend/tests/arrow_functions/gh7900.phpt
+++ b/Zend/tests/arrow_functions/gh7900.phpt
@@ -10,17 +10,17 @@ $x = fn(): never => throw new \Exception('Here');
try {
var_dump($x());
-} catch (\Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert((fn(): never => 42) && false);
-} catch (\Error $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Here
-assert((fn(): never => 42) && false)
+Exception: Here
+AssertionError: assert((fn(): never => 42) && false)
diff --git a/Zend/tests/assert/bug70528.phpt b/Zend/tests/assert/bug70528.phpt
index 717c096fdaa3..57aa6706de16 100644
--- a/Zend/tests/assert/bug70528.phpt
+++ b/Zend/tests/assert/bug70528.phpt
@@ -11,21 +11,21 @@ class Bar {}
$bar = "Bar";
try {
assert(new \stdClass instanceof $bar);
-} catch (\AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(new \stdClass instanceof Bar);
-} catch (\AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(new \stdClass instanceof \Foo\Bar);
-} catch (\AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(): assert(new \stdClass() instanceof $bar) failed
-assert(): assert(new \stdClass() instanceof Bar) failed
-assert(): assert(new \stdClass() instanceof \Foo\Bar) failed
+AssertionError: assert(new \stdClass() instanceof $bar)
+AssertionError: assert(new \stdClass() instanceof Bar)
+AssertionError: assert(new \stdClass() instanceof \Foo\Bar)
diff --git a/Zend/tests/assert/bug71922.phpt b/Zend/tests/assert/bug71922.phpt
index 986254cab732..e996b97dba41 100644
--- a/Zend/tests/assert/bug71922.phpt
+++ b/Zend/tests/assert/bug71922.phpt
@@ -10,12 +10,12 @@ try {
assert(0 && new class {
} && new class(42) extends stdclass {
});
-} catch (AssertionError $e) {
- echo "Assertion failure: ", $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Assertion failure: assert(0 && new class {
+AssertionError: assert(0 && new class {
} && new class(42) extends stdclass {
})
diff --git a/Zend/tests/assert/expect_003.phpt b/Zend/tests/assert/expect_003.phpt
index 350fca6e57b0..6701718daa8e 100644
--- a/Zend/tests/assert/expect_003.phpt
+++ b/Zend/tests/assert/expect_003.phpt
@@ -7,9 +7,9 @@ assert.exception=1
<?php
try {
assert(false);
-} catch (AssertionError $ex) {
- var_dump($ex->getMessage());
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
-string(13) "assert(false)"
+AssertionError: assert(false)
diff --git a/Zend/tests/assert/expect_004.phpt b/Zend/tests/assert/expect_004.phpt
index 111e37295fe9..c89741d5b3d1 100644
--- a/Zend/tests/assert/expect_004.phpt
+++ b/Zend/tests/assert/expect_004.phpt
@@ -7,9 +7,9 @@ assert.exception=1
<?php
try {
assert(false, "I require this to succeed");
-} catch (AssertionError $ex) {
- var_dump($ex->getMessage());
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
-string(25) "I require this to succeed"
+AssertionError: I require this to succeed
diff --git a/Zend/tests/assert/expect_005.phpt b/Zend/tests/assert/expect_005.phpt
index f2c91f25666e..07747665c569 100644
--- a/Zend/tests/assert/expect_005.phpt
+++ b/Zend/tests/assert/expect_005.phpt
@@ -8,8 +8,8 @@ assert.exception=1
try {
/* by passing we test there are no leaks upon success */
assert(true, "I require this to succeed");
-} catch (AssertionError $ex) {
- var_dump($ex->getMessage());
+} catch (Throwable $ex) {
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
var_dump(true);
?>
diff --git a/Zend/tests/assert/expect_015.phpt b/Zend/tests/assert/expect_015.phpt
index 3bb08504f581..5834b99d9dad 100644
--- a/Zend/tests/assert/expect_015.phpt
+++ b/Zend/tests/assert/expect_015.phpt
@@ -19,8 +19,8 @@ assert(0 && ($a = function () {
yield 1 => 2;
yield from $x;
}));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
@@ -68,8 +68,8 @@ assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
}
}
}));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
@@ -104,8 +104,8 @@ L0:
}
}
}));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
@@ -120,8 +120,8 @@ assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X {
use T3;
}
}));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
@@ -137,8 +137,8 @@ assert(0 && ($a = function &(array &...$a) {
echo 3;
}
}));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
@@ -165,13 +165,13 @@ assert(0 && ($a = function (): ?static {
}
if ($a); else;
}));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(0 && ($a = function () {
+AssertionError: assert(0 && ($a = function () {
global $a;
global $$b;
static $c;
@@ -187,7 +187,7 @@ assert(0 && ($a = function () {
yield 1 => 2;
yield from $x;
}))
-assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
+AssertionError: assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
abstract class A extends B implements C, D {
public const X = 12;
public const Y = self::X, Z = 'aaa';
@@ -231,7 +231,7 @@ assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
}
}))
-assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d): X {
+AssertionError: assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d): X {
final class A {
protected final function f2() {
if (!$x) {
@@ -270,7 +270,7 @@ assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d):
}
}))
-assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
+AssertionError: assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
class A {
use T1, T2 {
T1::foo insteadof foo;
@@ -282,7 +282,7 @@ assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
}
}))
-assert(0 && ($a = function &(array &...$a) {
+AssertionError: assert(0 && ($a = function &(array &...$a) {
declare(A = 1, B = 2);
try {
$i++;
@@ -294,7 +294,7 @@ assert(0 && ($a = function &(array &...$a) {
echo 3;
}
}))
-assert(0 && ($a = function (): ?static {
+AssertionError: assert(0 && ($a = function (): ?static {
declare(C = 1) {
echo 1;
}
diff --git a/Zend/tests/assert/expect_016.phpt b/Zend/tests/assert/expect_016.phpt
index 32e8fea91715..ad738aef482f 100644
--- a/Zend/tests/assert/expect_016.phpt
+++ b/Zend/tests/assert/expect_016.phpt
@@ -10,8 +10,8 @@ var_dump(assert(true));
ini_set("zend.assertions", 1);
try {
var_dump(assert(false));
-} catch (AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(assert(true));
ini_set("zend.assertions", -1);
@@ -19,7 +19,7 @@ ini_set("zend.assertions", -1);
--EXPECTF--
bool(true)
bool(true)
-assert(): assert(false) failed
+AssertionError: assert(false)
bool(true)
Warning: zend.assertions may be completely enabled or disabled only in php.ini in %s on line %d
diff --git a/Zend/tests/assert/expect_018.phpt b/Zend/tests/assert/expect_018.phpt
index abe74ce25225..7a927d0a65e3 100644
--- a/Zend/tests/assert/expect_018.phpt
+++ b/Zend/tests/assert/expect_018.phpt
@@ -14,14 +14,14 @@ var_dump(assert(true));
ini_set("zend.assertions", 1);
try {
var_dump(\assert(false));
-} catch (\AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(\assert(true));
try {
var_dump(assert(false));
-} catch (\AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(assert(true));
?>
@@ -30,7 +30,7 @@ bool(true)
bool(true)
bool(true)
bool(true)
-assert(): assert(false) failed
+AssertionError: assert(false)
bool(true)
-assert(): assert(false) failed
+AssertionError: assert(false)
bool(true)
diff --git a/Zend/tests/assign_dim_obj_null_return.phpt b/Zend/tests/assign_dim_obj_null_return.phpt
index e2b7f20a0c07..0ee2a93a8b7b 100644
--- a/Zend/tests/assign_dim_obj_null_return.phpt
+++ b/Zend/tests/assign_dim_obj_null_return.phpt
@@ -9,61 +9,61 @@ function test() {
try {
var_dump($array[] = 123);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($array[[]] = 123);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($array[new stdClass] = 123);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($true[123] = 456);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($array[] += 123);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($array[[]] += 123);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($array[new stdClass] += 123);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($true[123] += 456);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($true->foo = 123);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($true->foo += 123);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -71,13 +71,13 @@ test();
?>
--EXPECT--
-Cannot add element to the array as the next element is already occupied
-Cannot access offset of type array on array
-Cannot access offset of type stdClass on array
-Cannot use a scalar value as an array
-Cannot add element to the array as the next element is already occupied
-Cannot access offset of type array on array
-Cannot access offset of type stdClass on array
-Cannot use a scalar value as an array
-Attempt to assign property "foo" on true
-Attempt to assign property "foo" on true
+Error: Cannot add element to the array as the next element is already occupied
+TypeError: Cannot access offset of type array on array
+TypeError: Cannot access offset of type stdClass on array
+Error: Cannot use a scalar value as an array
+Error: Cannot add element to the array as the next element is already occupied
+TypeError: Cannot access offset of type array on array
+TypeError: Cannot access offset of type stdClass on array
+Error: Cannot use a scalar value as an array
+Error: Attempt to assign property "foo" on true
+Error: Attempt to assign property "foo" on true
diff --git a/Zend/tests/assign_op_type_error.phpt b/Zend/tests/assign_op_type_error.phpt
index 5f175613e20b..3068e0ca48be 100644
--- a/Zend/tests/assign_op_type_error.phpt
+++ b/Zend/tests/assign_op_type_error.phpt
@@ -6,52 +6,52 @@ TypeError for compound assignment operations
$x = [];
try {
$x += "1";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$x -= "1";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$x *= "1";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$x /= "1";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$x **= "1";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$x %= "1";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$x <<= "1";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$x >>= "1";
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Unsupported operand types: array + string
-Unsupported operand types: array - string
-Unsupported operand types: array * string
-Unsupported operand types: array / string
-Unsupported operand types: array ** string
-Unsupported operand types: array % string
-Unsupported operand types: array << string
-Unsupported operand types: array >> string
+TypeError: Unsupported operand types: array + string
+TypeError: Unsupported operand types: array - string
+TypeError: Unsupported operand types: array * string
+TypeError: Unsupported operand types: array / string
+TypeError: Unsupported operand types: array ** string
+TypeError: Unsupported operand types: array % string
+TypeError: Unsupported operand types: array << string
+TypeError: Unsupported operand types: array >> string
diff --git a/Zend/tests/assign_property_null_object.phpt b/Zend/tests/assign_property_null_object.phpt
index fff2c99f6201..622746ba0ee9 100644
--- a/Zend/tests/assign_property_null_object.phpt
+++ b/Zend/tests/assign_property_null_object.phpt
@@ -15,8 +15,8 @@ print "ok\n";
try {
$test->a()->a = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
print "ok\n";
@@ -24,5 +24,5 @@ print "ok\n";
--EXPECTF--
Warning: Attempt to read property "a" on null in %s on line %d
ok
-Attempt to assign property "a" on null
+Error: Attempt to assign property "a" on null
ok
diff --git a/Zend/tests/assign_ref_error_var_handling.phpt b/Zend/tests/assign_ref_error_var_handling.phpt
index 2a66b68cc549..3fbbcefe337a 100644
--- a/Zend/tests/assign_ref_error_var_handling.phpt
+++ b/Zend/tests/assign_ref_error_var_handling.phpt
@@ -11,20 +11,20 @@ $var = 24;
$arr = [PHP_INT_MAX => "foo"];
try {
var_dump($arr[] =& $var);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(count($arr));
try {
var_dump($arr[] =& val());
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(count($arr));
?>
--EXPECT--
-Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
int(1)
-Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
int(1)
diff --git a/Zend/tests/assign_to_obj_002.phpt b/Zend/tests/assign_to_obj_002.phpt
index a911c06f36d5..52541e28e06f 100644
--- a/Zend/tests/assign_to_obj_002.phpt
+++ b/Zend/tests/assign_to_obj_002.phpt
@@ -5,8 +5,8 @@ Assign to $this leaks when $this not defined
try {
$this->a = new stdClass;
-} catch (Error $e) { echo $e->getMessage(), "\n"; }
+} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }
?>
--EXPECT--
-Using $this when not in object context
+Error: Using $this when not in object context
diff --git a/Zend/tests/ast/ast_serialize_backtick_literal.phpt b/Zend/tests/ast/ast_serialize_backtick_literal.phpt
index 46aa0ebe8ae2..85e5dd6fbb66 100644
--- a/Zend/tests/ast/ast_serialize_backtick_literal.phpt
+++ b/Zend/tests/ast/ast_serialize_backtick_literal.phpt
@@ -7,10 +7,10 @@ zend.assertions=1
try {
assert(false && `echo -n ""`);
-} catch (AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(): assert(false && `echo -n ""`) failed
+AssertionError: assert(false && `echo -n ""`)
diff --git a/Zend/tests/ast/ast_serialize_floats.phpt b/Zend/tests/ast/ast_serialize_floats.phpt
index 164b8b03338c..73426b0ded3b 100644
--- a/Zend/tests/ast/ast_serialize_floats.phpt
+++ b/Zend/tests/ast/ast_serialize_floats.phpt
@@ -6,21 +6,21 @@ zend.assertions=1
<?php
try {
assert(!is_float(0.0));
-} catch (AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(!is_float(1.1));
-} catch (AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(!is_float(1234.5678));
-} catch (AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(): assert(!is_float(0.0)) failed
-assert(): assert(!is_float(1.1)) failed
-assert(): assert(!is_float(1234.5678)) failed
+AssertionError: assert(!is_float(0.0))
+AssertionError: assert(!is_float(1.1))
+AssertionError: assert(!is_float(1234.5678))
diff --git a/Zend/tests/ast/gh21072.phpt b/Zend/tests/ast/gh21072.phpt
index 1ffd0518eaea..88b9d0e00304 100644
--- a/Zend/tests/ast/gh21072.phpt
+++ b/Zend/tests/ast/gh21072.phpt
@@ -9,8 +9,8 @@ try {
public $p = (unset) C::class;
}
new C;
-} catch (Error $e) {
- echo $e->getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
diff --git a/Zend/tests/ast/zend-pow-assign.phpt b/Zend/tests/ast/zend-pow-assign.phpt
index fd8bf8346cec..98ad319fc7a2 100644
--- a/Zend/tests/ast/zend-pow-assign.phpt
+++ b/Zend/tests/ast/zend-pow-assign.phpt
@@ -7,9 +7,9 @@ zend.assertions=1
try {
assert(false && ($a **= 2));
-} catch (AssertionError $e) {
- echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(): assert(false && ($a **= 2)) failed
+AssertionError: assert(false && ($a **= 2))
diff --git a/Zend/tests/asymmetric_visibility/__set.phpt b/Zend/tests/asymmetric_visibility/__set.phpt
index 7476f5304e25..17c6aaef1bd2 100644
--- a/Zend/tests/asymmetric_visibility/__set.phpt
+++ b/Zend/tests/asymmetric_visibility/__set.phpt
@@ -22,15 +22,15 @@ class Foo {
$foo = new Foo();
try {
$foo->bar = 'baz';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->setBar('baz');
try {
$foo->bar = 'baz';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->unsetBar();
@@ -38,6 +38,6 @@ $foo->bar = 'baz';
?>
--EXPECT--
-Cannot modify private(set) property Foo::$bar from global scope
-Cannot modify private(set) property Foo::$bar from global scope
+Error: Cannot modify private(set) property Foo::$bar from global scope
+Error: Cannot modify private(set) property Foo::$bar from global scope
Foo::Foo::__set
diff --git a/Zend/tests/asymmetric_visibility/__unset.phpt b/Zend/tests/asymmetric_visibility/__unset.phpt
index 3d5977d79782..ca065080bf98 100644
--- a/Zend/tests/asymmetric_visibility/__unset.phpt
+++ b/Zend/tests/asymmetric_visibility/__unset.phpt
@@ -22,8 +22,8 @@ class Foo {
function test($foo) {
try {
unset($foo->bar);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -41,7 +41,7 @@ test($foo);
?>
--EXPECT--
-Cannot unset private(set) property Foo::$bar from global scope
+Error: Cannot unset private(set) property Foo::$bar from global scope
Foo::__unset
-Cannot unset private(set) property Foo::$bar from global scope
+Error: Cannot unset private(set) property Foo::$bar from global scope
Foo::__unset
diff --git a/Zend/tests/asymmetric_visibility/ast_printing.phpt b/Zend/tests/asymmetric_visibility/ast_printing.phpt
index 25803e67c09d..aabf2a3df2c2 100644
--- a/Zend/tests/asymmetric_visibility/ast_printing.phpt
+++ b/Zend/tests/asymmetric_visibility/ast_printing.phpt
@@ -13,13 +13,13 @@ try {
public protected(set) string $baz;
}
} && false);
-} catch (Error $e) {
- echo $e->getMessage();
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(function () {
+AssertionError: assert(function () {
class Foo {
public private(set) string $bar;
public protected(set) string $baz;
diff --git a/Zend/tests/asymmetric_visibility/bug001.phpt b/Zend/tests/asymmetric_visibility/bug001.phpt
index c306434d610b..28c4e9c8c626 100644
--- a/Zend/tests/asymmetric_visibility/bug001.phpt
+++ b/Zend/tests/asymmetric_visibility/bug001.phpt
@@ -19,14 +19,14 @@ class D extends C {
$c = new D();
try {
unset($c->a);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($c);
?>
--EXPECTF--
-Cannot unset private(set) property C::$a from scope D
+Error: Cannot unset private(set) property C::$a from scope D
object(D)#%d (0) {
["a"]=>
uninitialized(int)
diff --git a/Zend/tests/asymmetric_visibility/bug002.phpt b/Zend/tests/asymmetric_visibility/bug002.phpt
index 1f6dc2b85278..bca8864f29f1 100644
--- a/Zend/tests/asymmetric_visibility/bug002.phpt
+++ b/Zend/tests/asymmetric_visibility/bug002.phpt
@@ -19,14 +19,14 @@ class D extends C {
$c = new D();
try {
$c->a = 2;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($c);
?>
--EXPECTF--
-Cannot modify private(set) property C::$a from scope D
+Error: Cannot modify private(set) property C::$a from scope D
object(D)#%d (0) {
["a"]=>
uninitialized(int)
diff --git a/Zend/tests/asymmetric_visibility/bug003.phpt b/Zend/tests/asymmetric_visibility/bug003.phpt
index 9f541f87f7cd..af840222be71 100644
--- a/Zend/tests/asymmetric_visibility/bug003.phpt
+++ b/Zend/tests/asymmetric_visibility/bug003.phpt
@@ -13,16 +13,16 @@ class C {
$c = new C();
try {
$c->a = 2;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
unset($c->a);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot modify private(set) property C::$a from global scope
-Cannot unset private(set) property C::$a from global scope
+Error: Cannot modify private(set) property C::$a from global scope
+Error: Cannot unset private(set) property C::$a from global scope
diff --git a/Zend/tests/asymmetric_visibility/cpp_private.phpt b/Zend/tests/asymmetric_visibility/cpp_private.phpt
index c308330d3ab0..4430f88f4f92 100644
--- a/Zend/tests/asymmetric_visibility/cpp_private.phpt
+++ b/Zend/tests/asymmetric_visibility/cpp_private.phpt
@@ -18,8 +18,8 @@ var_dump($foo->bar);
try {
$foo->bar = 'baz';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->setBar('baz');
@@ -28,5 +28,5 @@ var_dump($foo->bar);
?>
--EXPECT--
string(3) "bar"
-Cannot modify private(set) property Foo::$bar from global scope
+Error: Cannot modify private(set) property Foo::$bar from global scope
string(3) "baz"
diff --git a/Zend/tests/asymmetric_visibility/cpp_protected.phpt b/Zend/tests/asymmetric_visibility/cpp_protected.phpt
index f13351e32003..5cb6be2c99ac 100644
--- a/Zend/tests/asymmetric_visibility/cpp_protected.phpt
+++ b/Zend/tests/asymmetric_visibility/cpp_protected.phpt
@@ -24,8 +24,8 @@ var_dump($foo->bar);
try {
$foo->bar = 'baz';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->setBarPrivate('baz');
@@ -37,6 +37,6 @@ var_dump($foo->bar);
?>
--EXPECT--
string(3) "bar"
-Cannot modify protected(set) property Foo::$bar from global scope
+Error: Cannot modify protected(set) property Foo::$bar from global scope
string(3) "baz"
string(3) "qux"
diff --git a/Zend/tests/asymmetric_visibility/dim_add.phpt b/Zend/tests/asymmetric_visibility/dim_add.phpt
index f7bf0ceaf939..9038f1d3186d 100644
--- a/Zend/tests/asymmetric_visibility/dim_add.phpt
+++ b/Zend/tests/asymmetric_visibility/dim_add.phpt
@@ -15,8 +15,8 @@ $foo = new Foo();
try {
$foo->bars[] = 'baz';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($foo->bars);
@@ -25,7 +25,7 @@ var_dump($foo->bars);
?>
--EXPECT--
-Cannot indirectly modify private(set) property Foo::$bars from global scope
+Error: Cannot indirectly modify private(set) property Foo::$bars from global scope
array(0) {
}
array(1) {
diff --git a/Zend/tests/asymmetric_visibility/optimizer_shared_cache_slot.phpt b/Zend/tests/asymmetric_visibility/optimizer_shared_cache_slot.phpt
index 2e24ad1f8d03..96c08c840dc8 100644
--- a/Zend/tests/asymmetric_visibility/optimizer_shared_cache_slot.phpt
+++ b/Zend/tests/asymmetric_visibility/optimizer_shared_cache_slot.phpt
@@ -14,8 +14,8 @@ class C extends P {
var_dump($this->prop);
try {
$this->prop = 'overwritten';
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($this->prop);
}
@@ -27,8 +27,8 @@ $c->test();
?>
--EXPECT--
string(7) "default"
-Cannot modify private(set) property P::$prop from scope C
+Error: Cannot modify private(set) property P::$prop from scope C
string(7) "default"
string(7) "default"
-Cannot modify private(set) property P::$prop from scope C
+Error: Cannot modify private(set) property P::$prop from scope C
string(7) "default"
diff --git a/Zend/tests/asymmetric_visibility/private.phpt b/Zend/tests/asymmetric_visibility/private.phpt
index 48e557c6e87d..bcdb33b39ffd 100644
--- a/Zend/tests/asymmetric_visibility/private.phpt
+++ b/Zend/tests/asymmetric_visibility/private.phpt
@@ -28,8 +28,8 @@ var_dump($foo->bar);
try {
$foo->bar = 'baz';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->setBar('baz');
@@ -37,8 +37,8 @@ var_dump($foo->bar);
try {
$foo->baz = 'baz2';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->setBaz('baz2');
@@ -47,15 +47,15 @@ var_dump($foo->baz);
$child = new FooChild();
try {
$child->modifyBar('baz');
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
string(3) "bar"
-Cannot modify private(set) property Foo::$bar from global scope
+Error: Cannot modify private(set) property Foo::$bar from global scope
string(3) "baz"
-Cannot modify private(set) property Foo::$baz from global scope
+Error: Cannot modify private(set) property Foo::$baz from global scope
string(4) "baz2"
-Cannot modify private(set) property Foo::$bar from scope FooChild
+Error: Cannot modify private(set) property Foo::$bar from scope FooChild
diff --git a/Zend/tests/asymmetric_visibility/protected.phpt b/Zend/tests/asymmetric_visibility/protected.phpt
index 49a39b399362..9c79752c23c7 100644
--- a/Zend/tests/asymmetric_visibility/protected.phpt
+++ b/Zend/tests/asymmetric_visibility/protected.phpt
@@ -32,8 +32,8 @@ var_dump($foo->bar);
try {
$foo->bar = 'baz';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->setBarPrivate('baz');
@@ -44,8 +44,8 @@ var_dump($foo->bar);
try {
$foo->baz = 'baz';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->setbazPrivate('baz2');
@@ -58,9 +58,9 @@ var_dump($foo->baz);
?>
--EXPECT--
string(3) "bar"
-Cannot modify protected(set) property Foo::$bar from global scope
+Error: Cannot modify protected(set) property Foo::$bar from global scope
string(3) "baz"
string(3) "qux"
-Cannot modify protected(set) property Foo::$baz from global scope
+Error: Cannot modify protected(set) property Foo::$baz from global scope
string(4) "baz2"
string(4) "baz3"
diff --git a/Zend/tests/asymmetric_visibility/readonly.phpt b/Zend/tests/asymmetric_visibility/readonly.phpt
index e02d36907998..d8ae18bb1bea 100644
--- a/Zend/tests/asymmetric_visibility/readonly.phpt
+++ b/Zend/tests/asymmetric_visibility/readonly.phpt
@@ -22,8 +22,8 @@ class C extends P {
$this->pDefault = 1;
try {
$this->pPrivate = 1;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$this->pProtected = 1;
$this->pPublic = 1;
@@ -34,18 +34,18 @@ function test() {
$p = new ReflectionClass(P::class)->newInstanceWithoutConstructor();
try {
$p->pDefault = 1;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$p->pPrivate = 1;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$p->pProtected = 1;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$p->pPublic = 1;
}
@@ -56,7 +56,7 @@ test();
?>
--EXPECT--
-Cannot modify private(set) property P::$pPrivate from scope C
-Cannot modify protected(set) readonly property P::$pDefault from global scope
-Cannot modify private(set) property P::$pPrivate from global scope
-Cannot modify protected(set) readonly property P::$pProtected from global scope
+Error: Cannot modify private(set) property P::$pPrivate from scope C
+Error: Cannot modify protected(set) readonly property P::$pDefault from global scope
+Error: Cannot modify private(set) property P::$pPrivate from global scope
+Error: Cannot modify protected(set) readonly property P::$pProtected from global scope
diff --git a/Zend/tests/asymmetric_visibility/reference.phpt b/Zend/tests/asymmetric_visibility/reference.phpt
index ae5271418282..34c0324b988e 100644
--- a/Zend/tests/asymmetric_visibility/reference.phpt
+++ b/Zend/tests/asymmetric_visibility/reference.phpt
@@ -17,8 +17,8 @@ $foo = new Foo();
try {
$bar = &$foo->bar;
$bar++;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($foo->bar);
@@ -27,6 +27,6 @@ var_dump($foo->bar);
?>
--EXPECT--
-Cannot indirectly modify private(set) property Foo::$bar from global scope
+Error: Cannot indirectly modify private(set) property Foo::$bar from global scope
int(0)
int(1)
diff --git a/Zend/tests/asymmetric_visibility/reference_2.phpt b/Zend/tests/asymmetric_visibility/reference_2.phpt
index d4ef6c03a788..ba5c0e5ac2be 100644
--- a/Zend/tests/asymmetric_visibility/reference_2.phpt
+++ b/Zend/tests/asymmetric_visibility/reference_2.phpt
@@ -14,17 +14,17 @@ function test($c) {
try {
test(new C());
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(new C());
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot indirectly modify private(set) property C::$prop from global scope
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
diff --git a/Zend/tests/asymmetric_visibility/scope_rebinding.phpt b/Zend/tests/asymmetric_visibility/scope_rebinding.phpt
index 8c10d10f77a4..4351e8796e5d 100644
--- a/Zend/tests/asymmetric_visibility/scope_rebinding.phpt
+++ b/Zend/tests/asymmetric_visibility/scope_rebinding.phpt
@@ -18,19 +18,19 @@ $c = function () use ($foo) {
var_dump($foo->bar);
try {
$c();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
($c->bindTo(null, Bar::class))();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($foo->bar);
?>
--EXPECT--
int(2)
-Cannot modify private(set) property Foo::$bar from global scope
-Cannot modify private(set) property Foo::$bar from scope Bar
+Error: Cannot modify private(set) property Foo::$bar from global scope
+Error: Cannot modify private(set) property Foo::$bar from scope Bar
int(2)
diff --git a/Zend/tests/asymmetric_visibility/static_props.phpt b/Zend/tests/asymmetric_visibility/static_props.phpt
index f47dcf70b6f7..1bba69bebd4e 100644
--- a/Zend/tests/asymmetric_visibility/static_props.phpt
+++ b/Zend/tests/asymmetric_visibility/static_props.phpt
@@ -29,8 +29,8 @@ function test() {
try {
C::$prop = 2;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(C::$prop);
@@ -39,30 +39,30 @@ function test() {
try {
++C::$prop;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(C::$prop);
try {
C::$prop++;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(C::$prop);
try {
C::$prop += str_repeat('a', 10);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(C::$prop);
try {
$ref = &C::$prop;
$ref++;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(C::$prop);
@@ -70,15 +70,15 @@ function test() {
$ref = 4;
C::$prop = &$ref;
$ref++;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(C::$prop);
try {
C::$prop2[] = 'foo';
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(C::$prop2);
@@ -97,20 +97,20 @@ test();
?>
--EXPECTF--
-Cannot modify private(set) property C::$prop from global scope
+Error: Cannot modify private(set) property C::$prop from global scope
int(1)
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop2 from global scope
+Error: Cannot indirectly modify private(set) property C::$prop2 from global scope
array(0) {
}
array(1) {
@@ -123,20 +123,20 @@ object(stdClass)#%d (1) {
}
Repeat:
-Cannot modify private(set) property C::$prop from global scope
+Error: Cannot modify private(set) property C::$prop from global scope
int(1)
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop from global scope
+Error: Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
-Cannot indirectly modify private(set) property C::$prop2 from global scope
+Error: Cannot indirectly modify private(set) property C::$prop2 from global scope
array(0) {
}
array(1) {
diff --git a/Zend/tests/asymmetric_visibility/unset.phpt b/Zend/tests/asymmetric_visibility/unset.phpt
index 3fd3d7673081..039bdb84bb40 100644
--- a/Zend/tests/asymmetric_visibility/unset.phpt
+++ b/Zend/tests/asymmetric_visibility/unset.phpt
@@ -36,8 +36,8 @@ $foo = new FooChild();
$foo->setBar('bar');
try {
unset($foo->bar);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($foo->bar ?? 'unset');
@@ -52,16 +52,16 @@ var_dump($foo->bar ?? 'unset');
$foo->setSecret('beep');
try {
$foo->unsetSecret();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($foo->secret ?? 'unset');
?>
--EXPECT--
-Cannot unset protected(set) property Foo::$bar from global scope
+Error: Cannot unset protected(set) property Foo::$bar from global scope
string(3) "bar"
string(5) "unset"
string(5) "unset"
-Cannot unset private(set) property Foo::$secret from scope FooChild
+Error: Cannot unset private(set) property Foo::$secret from scope FooChild
string(4) "beep"
diff --git a/Zend/tests/asymmetric_visibility/unshared_rw_cache_slot.phpt b/Zend/tests/asymmetric_visibility/unshared_rw_cache_slot.phpt
index d81f4d3891bf..9c57c85a30a9 100644
--- a/Zend/tests/asymmetric_visibility/unshared_rw_cache_slot.phpt
+++ b/Zend/tests/asymmetric_visibility/unshared_rw_cache_slot.phpt
@@ -17,20 +17,20 @@ class C extends P {
$c = new C();
try {
$c->setBar(1);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$c->setBar(1);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($c);
?>
--EXPECTF--
-Typed property P::$bar must not be accessed before initialization
-Typed property P::$bar must not be accessed before initialization
+Error: Typed property P::$bar must not be accessed before initialization
+Error: Typed property P::$bar must not be accessed before initialization
object(C)#%d (0) {
["bar"]=>
uninitialized(string)
diff --git a/Zend/tests/attributes/003_ast_nodes.phpt b/Zend/tests/attributes/003_ast_nodes.phpt
index 854edf3d63c1..2d47a89e78b4 100644
--- a/Zend/tests/attributes/003_ast_nodes.phpt
+++ b/Zend/tests/attributes/003_ast_nodes.phpt
@@ -71,14 +71,14 @@ var_dump(count($attr));
try {
$attr[0]->getArguments();
-} catch (\Error $e) {
- var_dump($e->getMessage());
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$attr[0]->newInstance();
-} catch (\Error $e) {
- var_dump($e->getMessage());
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -104,5 +104,5 @@ array(1) {
}
int(1)
-string(30) "Class "MissingClass" not found"
-string(30) "Class "MissingClass" not found"
+Error: Class "MissingClass" not found
+Error: Class "MissingClass" not found
diff --git a/Zend/tests/attributes/005_objects.phpt b/Zend/tests/attributes/005_objects.phpt
index 2b08db838b27..4e0bd69ce3c2 100644
--- a/Zend/tests/attributes/005_objects.phpt
+++ b/Zend/tests/attributes/005_objects.phpt
@@ -30,8 +30,8 @@ $ref = new \ReflectionFunction(#[A1] function () { });
try {
$ref->getAttributes()[0]->newInstance();
-} catch (\ArgumentCountError $e) {
- var_dump('ERROR 1', $e->getMessage());
+} catch (\Throwable $e) {
+ echo 'ERROR 1: ', $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -40,8 +40,8 @@ $ref = new \ReflectionFunction(#[A1([])] function () { });
try {
$ref->getAttributes()[0]->newInstance();
-} catch (\TypeError $e) {
- var_dump('ERROR 2', $e->getMessage());
+} catch (\Throwable $e) {
+ echo 'ERROR 2: ', $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -50,8 +50,8 @@ $ref = new \ReflectionFunction(#[A2] function () { });
try {
$ref->getAttributes()[0]->newInstance();
-} catch (\Error $e) {
- var_dump('ERROR 3', $e->getMessage());
+} catch (\Throwable $e) {
+ echo 'ERROR 3: ', $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -66,8 +66,8 @@ $ref = new \ReflectionFunction(#[A3] function () { });
try {
$ref->getAttributes()[0]->newInstance();
-} catch (\Error $e) {
- var_dump('ERROR 4', $e->getMessage());
+} catch (\Throwable $e) {
+ echo 'ERROR 4: ', $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -78,8 +78,8 @@ $ref = new \ReflectionFunction(#[A5] function () { });
try {
$ref->getAttributes()[0]->newInstance();
-} catch (\Error $e) {
- var_dump('ERROR 6', $e->getMessage());
+} catch (\Throwable $e) {
+ echo 'ERROR 6: ', $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -88,17 +88,12 @@ string(2) "A1"
string(4) "test"
int(50)
-string(7) "ERROR 1"
-string(%d) "Too few arguments to function A1::__construct(), 0 passed in %s005_objects.php on line 26 and at least 1 expected"
+ERROR 1: ArgumentCountError: Too few arguments to function A1::__construct(), 0 passed in %s005_objects.php on line 26 and at least 1 expected
-string(7) "ERROR 2"
-string(%d) "A1::__construct(): Argument #1 ($name) must be of type string, array given, called in %s005_objects.php on line 36"
+ERROR 2: TypeError: A1::__construct(): Argument #1 ($name) must be of type string, array given, called in %s005_objects.php on line 36
-string(7) "ERROR 3"
-string(30) "Attribute class "A2" not found"
+ERROR 3: Error: Attribute class "A2" not found
-string(7) "ERROR 4"
-string(51) "Call to private A3::__construct() from global scope"
+ERROR 4: Error: Call to private A3::__construct() from global scope
-string(7) "ERROR 6"
-string(55) "Attempting to use non-attribute class "A5" as attribute"
+ERROR 6: Error: Attempting to use non-attribute class "A5" as attribute
diff --git a/Zend/tests/attributes/006_filter.phpt b/Zend/tests/attributes/006_filter.phpt
index 2924e6ed7982..badbe9f9a5b3 100644
--- a/Zend/tests/attributes/006_filter.phpt
+++ b/Zend/tests/attributes/006_filter.phpt
@@ -56,16 +56,16 @@ $ref = new \ReflectionFunction(function () { });
try {
$ref->getAttributes(A1::class, 3);
-} catch (\Error $e) {
- var_dump('ERROR 1', $e->getMessage());
+} catch (\Throwable $e) {
+ echo 'ERROR 1: ', $e::class, ': ', $e->getMessage(), "\n";
}
$ref = new \ReflectionFunction(function () { });
try {
$ref->getAttributes(SomeMissingClass::class, \ReflectionAttribute::IS_INSTANCEOF);
-} catch (\Error $e) {
- var_dump('ERROR 2', $e->getMessage());
+} catch (\Throwable $e) {
+ echo 'ERROR 2: ', $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -106,7 +106,5 @@ Array
[2] => A3
)
-string(7) "ERROR 1"
-string(103) "ReflectionFunctionAbstract::getAttributes(): Argument #2 ($flags) must be a valid attribute filter flag"
-string(7) "ERROR 2"
-string(34) "Class "SomeMissingClass" not found"
+ERROR 1: ValueError: ReflectionFunctionAbstract::getAttributes(): Argument #2 ($flags) must be a valid attribute filter flag
+ERROR 2: Error: Class "SomeMissingClass" not found
diff --git a/Zend/tests/attributes/013_class_scope.phpt b/Zend/tests/attributes/013_class_scope.phpt
index ff16bb7b8225..d3991ad9f1c8 100644
--- a/Zend/tests/attributes/013_class_scope.phpt
+++ b/Zend/tests/attributes/013_class_scope.phpt
@@ -46,8 +46,8 @@ $attr = $ref->getMethod('foo')->getAttributes()[0];
try {
$attr->getArguments();
-} catch (\Error $e) {
- var_dump('ERROR 1', $e->getMessage());
+} catch (\Throwable $e) {
+ echo 'ERROR 1: ', $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -108,8 +108,7 @@ Array
[0] => C2
[1] => bar
)
-string(7) "ERROR 1"
-string(28) "Undefined constant self::FOO"
+ERROR 1: Error: Undefined constant self::FOO
bool(true)
string(3) "bar"
diff --git a/Zend/tests/attributes/020_userland_attribute_validation.phpt b/Zend/tests/attributes/020_userland_attribute_validation.phpt
index ce2acb26db16..008a892c707c 100644
--- a/Zend/tests/attributes/020_userland_attribute_validation.phpt
+++ b/Zend/tests/attributes/020_userland_attribute_validation.phpt
@@ -20,7 +20,7 @@ var_dump($attr->getName(), $attr->getTarget() == Attribute::TARGET_CLASS, $attr-
try {
$attr->newInstance();
} catch (\Throwable $e) {
- var_dump('ERROR 1', $e->getMessage());
+ echo 'ERROR 1: ', $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -32,7 +32,7 @@ var_dump($attr->getName(), $attr->getTarget() == Attribute::TARGET_FUNCTION, $at
try {
$attr->newInstance();
} catch (\Throwable $e) {
- var_dump('ERROR 2', $e->getMessage());
+ echo 'ERROR 2: ', $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n";
@@ -55,14 +55,12 @@ string(2) "A1"
string(2) "A1"
bool(true)
bool(false)
-string(7) "ERROR 1"
-string(70) "Attribute "A1" cannot target class (allowed targets: function, method)"
+ERROR 1: Error: Attribute "A1" cannot target class (allowed targets: function, method)
string(2) "A1"
bool(true)
bool(true)
-string(7) "ERROR 2"
-string(35) "Attribute "A1" must not be repeated"
+ERROR 2: Error: Attribute "A1" must not be repeated
string(2) "A2"
bool(true)
diff --git a/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt b/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt
index 70e4fdb7f338..fbcb598d135a 100644
--- a/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt
+++ b/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt
@@ -11,10 +11,10 @@ class Foo {}
try {
(new ReflectionClass(Foo::class))->getAttributes()[0]->newInstance();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Attribute::__construct(): Argument #1 ($flags) must be of type int, string given
+Error: Attribute::__construct(): Argument #1 ($flags) must be of type int, string given
diff --git a/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt b/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt
index efaa969af827..d06b92aad79c 100644
--- a/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt
+++ b/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt
@@ -11,10 +11,10 @@ class Foo { }
try {
var_dump((new ReflectionClass(Foo::class))->getAttributes()[0]->newInstance());
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Invalid attribute flags specified
+Error: Invalid attribute flags specified
diff --git a/Zend/tests/attributes/023_ast_node_in_validation.phpt b/Zend/tests/attributes/023_ast_node_in_validation.phpt
index 063a6b7e815d..10b2101d1747 100644
--- a/Zend/tests/attributes/023_ast_node_in_validation.phpt
+++ b/Zend/tests/attributes/023_ast_node_in_validation.phpt
@@ -11,10 +11,10 @@ class Bar { }
try {
var_dump((new ReflectionClass(Bar::class))->getAttributes()[0]->newInstance());
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Class "Foo" not found
+Error: Class "Foo" not found
diff --git a/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt b/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt
index b1efb538b328..43ff78e0720d 100644
--- a/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt
+++ b/Zend/tests/attributes/delayed_target_validation/has_runtime_errors.phpt
@@ -65,8 +65,8 @@ foreach ($cases as $r) {
var_dump($attributes);
try {
$attributes[1]->newInstance();
- } catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
diff --git a/Zend/tests/attributes/delayed_target_validation/opcache_validator_errors.phpt b/Zend/tests/attributes/delayed_target_validation/opcache_validator_errors.phpt
index 68d1ae43bd46..7fd5ef63b404 100644
--- a/Zend/tests/attributes/delayed_target_validation/opcache_validator_errors.phpt
+++ b/Zend/tests/attributes/delayed_target_validation/opcache_validator_errors.phpt
@@ -19,8 +19,8 @@ $attributes = $r->getAttributes();
var_dump($attributes);
try {
$attributes[1]->newInstance();
-} catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
diff --git a/Zend/tests/attributes/delayed_target_validation/validator_AllowDynamicProperties.phpt b/Zend/tests/attributes/delayed_target_validation/validator_AllowDynamicProperties.phpt
index 63add9e445a9..57063a55fbaa 100644
--- a/Zend/tests/attributes/delayed_target_validation/validator_AllowDynamicProperties.phpt
+++ b/Zend/tests/attributes/delayed_target_validation/validator_AllowDynamicProperties.phpt
@@ -32,8 +32,8 @@ foreach ($cases as $r) {
var_dump($attributes);
try {
$attributes[1]->newInstance();
- } catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
diff --git a/Zend/tests/attributes/delayed_target_validation/validator_Attribute.phpt b/Zend/tests/attributes/delayed_target_validation/validator_Attribute.phpt
index 0571024f19ce..ad618c84aca7 100644
--- a/Zend/tests/attributes/delayed_target_validation/validator_Attribute.phpt
+++ b/Zend/tests/attributes/delayed_target_validation/validator_Attribute.phpt
@@ -32,8 +32,8 @@ foreach ($cases as $r) {
var_dump($attributes);
try {
$attributes[1]->newInstance();
- } catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
diff --git a/Zend/tests/attributes/delayed_target_validation/validator_Deprecated.phpt b/Zend/tests/attributes/delayed_target_validation/validator_Deprecated.phpt
index f5fedb4ee68e..8e0e6f4fbf35 100644
--- a/Zend/tests/attributes/delayed_target_validation/validator_Deprecated.phpt
+++ b/Zend/tests/attributes/delayed_target_validation/validator_Deprecated.phpt
@@ -27,8 +27,8 @@ foreach ($cases as $r) {
var_dump($attributes);
try {
$attributes[1]->newInstance();
- } catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
diff --git a/Zend/tests/attributes/delayed_target_validation/validator_NoDiscard.phpt b/Zend/tests/attributes/delayed_target_validation/validator_NoDiscard.phpt
index e3cfe9d1c109..3009315b6c4e 100644
--- a/Zend/tests/attributes/delayed_target_validation/validator_NoDiscard.phpt
+++ b/Zend/tests/attributes/delayed_target_validation/validator_NoDiscard.phpt
@@ -25,8 +25,8 @@ foreach ($cases as $r) {
var_dump($attributes);
try {
$attributes[1]->newInstance();
- } catch (Error $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
diff --git a/Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt b/Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt
index ab84d4724226..97fdf986d287 100644
--- a/Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt
+++ b/Zend/tests/attributes/deprecated/class_constants/deprecated_constant_as_message_002.phpt
@@ -20,17 +20,17 @@ class Clazz {
try {
Clazz::TEST;
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
Clazz::TEST3;
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Caught: Constant Clazz::TEST is deprecated, from itself
-Caught: Constant Clazz::TEST2 is deprecated
+ErrorException: Constant Clazz::TEST is deprecated, from itself
+ErrorException: Constant Clazz::TEST2 is deprecated
diff --git a/Zend/tests/attributes/deprecated/constants/const_messages.phpt b/Zend/tests/attributes/deprecated/constants/const_messages.phpt
index 1cf8b11af156..2ced4e06fd29 100644
--- a/Zend/tests/attributes/deprecated/constants/const_messages.phpt
+++ b/Zend/tests/attributes/deprecated/constants/const_messages.phpt
@@ -46,4 +46,3 @@ Deprecated: Constant DeprecatedConst5 is deprecated since 1.0, use DEPRECATED_CO
Deprecated: Constant DeprecatedConst6 is deprecated since 1.0 in %s on line %d
6
-
diff --git a/Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt b/Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt
index f749293d8fac..6d12af0f2419 100644
--- a/Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt
+++ b/Zend/tests/attributes/deprecated/constants/deprecated_constant_as_message_002.phpt
@@ -18,17 +18,17 @@ const TEST3 = 1;
try {
TEST;
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
TEST3;
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Caught: Constant TEST is deprecated, from itself
-Caught: Constant TEST2 is deprecated
+ErrorException: Constant TEST is deprecated, from itself
+ErrorException: Constant TEST2 is deprecated
diff --git a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt
index af816aea6c4b..e4d1c4807d74 100644
--- a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt
+++ b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_001.phpt
@@ -14,8 +14,8 @@ function test() {
try {
test();
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
eval(<<<'CODE'
@@ -27,8 +27,8 @@ CODE);
try {
test2();
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
class Clazz {
@@ -41,8 +41,8 @@ class Clazz {
try {
$cls = new Clazz();
$cls->test();
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$closure = #[\Deprecated("convert to exception")] function () {
@@ -51,8 +51,8 @@ $closure = #[\Deprecated("convert to exception")] function () {
try {
$closure();
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
class Constructor {
@@ -64,8 +64,8 @@ class Constructor {
try {
new Constructor();
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
class Destructor {
@@ -77,15 +77,15 @@ class Destructor {
try {
new Destructor();
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-Caught: Function test() is deprecated, convert to exception
-Caught: Function test2() is deprecated, convert to exception
-Caught: Method Clazz::test() is deprecated, convert to exception
-Caught: Function {closure:%s:%d}() is deprecated, convert to exception
-Caught: Method Constructor::__construct() is deprecated, convert to exception
-Caught: Method Destructor::__destruct() is deprecated, convert to exception
+ErrorException: Function test() is deprecated, convert to exception
+ErrorException: Function test2() is deprecated, convert to exception
+ErrorException: Method Clazz::test() is deprecated, convert to exception
+ErrorException: Function {closure:%s:%d}() is deprecated, convert to exception
+ErrorException: Method Constructor::__construct() is deprecated, convert to exception
+ErrorException: Method Destructor::__destruct() is deprecated, convert to exception
diff --git a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_002.phpt b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_002.phpt
index 3c9c9ec952fc..0b8395aaae61 100644
--- a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_002.phpt
+++ b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_002.phpt
@@ -12,10 +12,10 @@ function test() {}
try {
$x = test();
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Caught: Function test() is deprecated
+ErrorException: Function test() is deprecated
diff --git a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_003.phpt b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_003.phpt
index 734a30795e5b..00efe2b69637 100644
--- a/Zend/tests/attributes/deprecated/functions/throwing_error_handler_003.phpt
+++ b/Zend/tests/attributes/deprecated/functions/throwing_error_handler_003.phpt
@@ -12,10 +12,10 @@ function test($dummy) {}
try {
$x = test(new stdClass());
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Caught: Function test() is deprecated
+ErrorException: Function test() is deprecated
diff --git a/Zend/tests/attributes/nodiscard/002.phpt b/Zend/tests/attributes/nodiscard/002.phpt
index 618aa2f6286d..c690212a52ad 100644
--- a/Zend/tests/attributes/nodiscard/002.phpt
+++ b/Zend/tests/attributes/nodiscard/002.phpt
@@ -41,4 +41,3 @@ __callStatic(test)
Warning: The return value of method Clazz::__invoke() should either be used or intentionally ignored by casting it as (void) in %s on line %d
__invoke(foo)
-
diff --git a/Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt b/Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt
index 51179b26ab19..0a8d2f8bbe78 100644
--- a/Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt
+++ b/Zend/tests/attributes/nodiscard/throwing_error_handler_001.phpt
@@ -14,8 +14,8 @@ function test(): int {
try {
test();
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
#[\NoDiscard]
@@ -25,11 +25,11 @@ function test2(): stdClass {
try {
test2();
-} catch (ErrorException $e) {
- echo "Caught: ", $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Caught: The return value of function test() should either be used or intentionally ignored by casting it as (void)
-Caught: The return value of function test2() should either be used or intentionally ignored by casting it as (void)
+ErrorException: The return value of function test() should either be used or intentionally ignored by casting it as (void)
+ErrorException: The return value of function test2() should either be used or intentionally ignored by casting it as (void)
diff --git a/Zend/tests/attributes/ossfuzz371445205.phpt b/Zend/tests/attributes/ossfuzz371445205.phpt
index 17e4f529a2a0..1959affaca6e 100644
--- a/Zend/tests/attributes/ossfuzz371445205.phpt
+++ b/Zend/tests/attributes/ossfuzz371445205.phpt
@@ -9,9 +9,9 @@ class Test1{}
$attr=(new ReflectionClass(Test1::class))->getAttributes()[0];
try {
$attr->newInstance();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Unknown named parameter $notinterned
+Error: Unknown named parameter $notinterned
diff --git a/Zend/tests/backtrace/debug_print_backtrace_from_main.phpt b/Zend/tests/backtrace/debug_print_backtrace_from_main.phpt
index f6ea383c397e..82f75742c774 100644
--- a/Zend/tests/backtrace/debug_print_backtrace_from_main.phpt
+++ b/Zend/tests/backtrace/debug_print_backtrace_from_main.phpt
@@ -5,4 +5,3 @@ Calling debug_print_backtrace() from main script
debug_print_backtrace();
?>
--EXPECT--
-
diff --git a/Zend/tests/bind_static_exception.phpt b/Zend/tests/bind_static_exception.phpt
index c374130aaecf..5cf689047601 100644
--- a/Zend/tests/bind_static_exception.phpt
+++ b/Zend/tests/bind_static_exception.phpt
@@ -10,9 +10,9 @@ class Test {
try {
$new = new Test;
static $new;
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Foo
+Exception: Foo
diff --git a/Zend/tests/bitwise_not_precision_exception.phpt b/Zend/tests/bitwise_not_precision_exception.phpt
index e28bf8f4e17b..c8b0c44c1806 100644
--- a/Zend/tests/bitwise_not_precision_exception.phpt
+++ b/Zend/tests/bitwise_not_precision_exception.phpt
@@ -7,9 +7,9 @@ set_error_handler(function($_, $msg) {
});
try {
var_dump(~INF);
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-The float INF is not representable as an int, cast occurred
+Exception: The float INF is not representable as an int, cast occurred
diff --git a/Zend/tests/bug26229.phpt b/Zend/tests/bug26229.phpt
index 5914b977ef51..d25fc7fcd5d7 100644
--- a/Zend/tests/bug26229.phpt
+++ b/Zend/tests/bug26229.phpt
@@ -19,10 +19,10 @@ try
var_dump($value);
}
}
-catch(Exception $e)
+catch(Throwable $e)
{
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Objects returned by array_iterator::getIterator() must be traversable or implement interface Iterator
+Exception: Objects returned by array_iterator::getIterator() must be traversable or implement interface Iterator
diff --git a/Zend/tests/bug31098.phpt b/Zend/tests/bug31098.phpt
index 862fc6fc46dc..b20d7f10923f 100644
--- a/Zend/tests/bug31098.phpt
+++ b/Zend/tests/bug31098.phpt
@@ -19,8 +19,8 @@ $simpleString = "Bogus String Text";
echo isset($simpleString->wrong)?"bug\n":"ok\n";
try {
echo isset($simpleString["wrong"])?"bug\n":"ok\n";
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo isset($simpleString[-20])?"bug\n":"ok\n";
echo isset($simpleString[0])?"ok\n":"bug\n";
@@ -30,15 +30,15 @@ echo isset($simpleString["17"])?"bug\n":"ok\n";
echo $simpleString->wrong === null?"ok\n":"bug\n";
try {
echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
try {
/* This must not affect the string value */
$simpleString["wrong"] = "f";
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
?>
@@ -59,7 +59,7 @@ ok
Warning: Attempt to read property "wrong" on string in %s on line %d
ok
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
ok
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
ok
diff --git a/Zend/tests/bug31720.phpt b/Zend/tests/bug31720.phpt
index 083ea78a0116..db04ef108ad5 100644
--- a/Zend/tests/bug31720.phpt
+++ b/Zend/tests/bug31720.phpt
@@ -6,10 +6,10 @@ $array = array('at least one element');
try {
array_walk($array, array($nonesuchvar,'show'));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Undefined variable $nonesuchvar in %s on line %d
-array_walk(): Argument #2 ($callback) must be a valid callback, first array member is not a valid class name or object
+TypeError: array_walk(): Argument #2 ($callback) must be a valid callback, first array member is not a valid class name or object
diff --git a/Zend/tests/bug33996.phpt b/Zend/tests/bug33996.phpt
index d5ec3386d6e9..849667e9eed8 100644
--- a/Zend/tests/bug33996.phpt
+++ b/Zend/tests/bug33996.phpt
@@ -22,16 +22,16 @@ function NormalTest($a)
try {
NormalTest();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
FooTest();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
FooTest(new Foo());
?>
--EXPECTF--
-Exception: Too few arguments to function NormalTest(), 0 passed in %sbug33996.php on line 18 and exactly 1 expected
-Exception: Too few arguments to function FooTest(), 0 passed in %sbug33996.php on line 23 and exactly 1 expected
+ArgumentCountError: Too few arguments to function NormalTest(), 0 passed in %sbug33996.php on line 18 and exactly 1 expected
+ArgumentCountError: Too few arguments to function FooTest(), 0 passed in %sbug33996.php on line 23 and exactly 1 expected
Hello!
diff --git a/Zend/tests/bug37811.phpt b/Zend/tests/bug37811.phpt
index b066ecd7abb9..dadd5a51ef23 100644
--- a/Zend/tests/bug37811.phpt
+++ b/Zend/tests/bug37811.phpt
@@ -19,8 +19,8 @@ define("Baz", new stdClass);
var_dump(Baz);
try {
var_dump((string) Baz);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -30,4 +30,4 @@ object(TestClass)#1 (0) {
string(3) "Foo"
object(stdClass)#2 (0) {
}
-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/bug44660.phpt b/Zend/tests/bug44660.phpt
index 02588c44b9d1..5a5c66f7216b 100644
--- a/Zend/tests/bug44660.phpt
+++ b/Zend/tests/bug44660.phpt
@@ -11,36 +11,36 @@ echo $a->p;
echo "\n--> direct assignment:\n";
try {
$a->p = $s;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n--> increment:\n";
try {
$a->p++;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n--> reference assignment:\n";
try {
$a->p =& $s;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n--> reference assignment:\n";
try {
$s =& $a->p;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n--> indexed assignment:\n";
try {
$a->p[0] = $s;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "\n--> Confirm assignments have had no impact:\n";
@@ -51,19 +51,19 @@ var_dump($a);
Warning: Attempt to read property "p" on true in %s on line %d
--> direct assignment:
-Attempt to assign property "p" on true
+Error: Attempt to assign property "p" on true
--> increment:
-Attempt to increment/decrement property "p" on true
+Error: Attempt to increment/decrement property "p" on true
--> reference assignment:
-Attempt to modify property "p" on true
+Error: Attempt to modify property "p" on true
--> reference assignment:
-Attempt to modify property "p" on true
+Error: Attempt to modify property "p" on true
--> indexed assignment:
-Attempt to modify property "p" on true
+Error: Attempt to modify property "p" on true
--> Confirm assignments have had no impact:
bool(true)
diff --git a/Zend/tests/bug46106.phpt b/Zend/tests/bug46106.phpt
index 7f0ae66debfe..dbb4a1bce219 100644
--- a/Zend/tests/bug46106.phpt
+++ b/Zend/tests/bug46106.phpt
@@ -17,11 +17,11 @@ function test($x) {
$x = new ReflectionFunction('str_pad');
try {
test($x);
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
DONE
--EXPECT--
-str_pad() expects at least 2 arguments, 1 given
+ArgumentCountError: str_pad() expects at least 2 arguments, 1 given
DONE