[PHP-CVS] [php-src] master: Zend: applied fixers to improve test robustness (part 5/8) (#23313)
[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:20:55+01:00
Commit: https://github.com/php/php-src/commit/430547e7d0e9b1de083466004daf9f0525010725
Raw diff: https://github.com/php/php-src/commit/430547e7d0e9b1de083466004daf9f0525010725.diff
Zend: applied fixers to improve test robustness (part 5/8) (#23313)
Changed paths:
M Zend/tests/named_params/cannot_pass_by_ref.phpt
M Zend/tests/named_params/ctor_extra_named_args.phpt
M Zend/tests/named_params/duplicate_param.phpt
M Zend/tests/named_params/gh17216.phpt
M Zend/tests/named_params/missing_param.phpt
M Zend/tests/named_params/unknown_named_param.phpt
M Zend/tests/named_params/unpack.phpt
M Zend/tests/named_params/unpack_and_named_1.phpt
M Zend/tests/namespaces/ns_076.phpt
M Zend/tests/not_002.phpt
M Zend/tests/nullsafe_operator/001.phpt
M Zend/tests/nullsafe_operator/002.phpt
M Zend/tests/nullsafe_operator/003.phpt
M Zend/tests/nullsafe_operator/013.phpt
M Zend/tests/nullsafe_operator/014.phpt
M Zend/tests/nullsafe_operator/016.phpt
M Zend/tests/nullsafe_operator/026.phpt
M Zend/tests/nullsafe_operator/033.phpt
M Zend/tests/nullsafe_operator/039.phpt
M Zend/tests/nullsafe_operator/constant_propagation.phpt
M Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt
M Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
M Zend/tests/numeric_strings/string_offset.phpt
M Zend/tests/offset_array.phpt
M Zend/tests/offset_string.phpt
M Zend/tests/offsets/appending_containers.phpt
M Zend/tests/oss_fuzz_434346548.phpt
M Zend/tests/pipe_operator/ast.phpt
M Zend/tests/pipe_operator/call_by_ref.phpt
M Zend/tests/pipe_operator/call_prefer_by_ref.phpt
M Zend/tests/pipe_operator/oss_fuzz_427814452.phpt
M Zend/tests/pipe_operator/prec_005.phpt
M Zend/tests/pow_array_leak.phpt
M Zend/tests/prop_const_expr/non_enums_rhs.phpt
M Zend/tests/property_access_errors_for_guarded_properties.phpt
M Zend/tests/property_exists_basic.phpt
M Zend/tests/property_hooks/ast_printing.phpt
M Zend/tests/property_hooks/backed_delegated_read_write.phpt
M Zend/tests/property_hooks/bug001.phpt
M Zend/tests/property_hooks/cache.phpt
M Zend/tests/property_hooks/default_value_inheritance.phpt
M Zend/tests/property_hooks/direct_hook_call.phpt
M Zend/tests/property_hooks/final_prop_promoted_ast.phpt
M Zend/tests/property_hooks/foreach_val_to_ref.phpt
M Zend/tests/property_hooks/get.phpt
M Zend/tests/property_hooks/get_by_ref.phpt
M Zend/tests/property_hooks/get_by_ref_auto.phpt
M Zend/tests/property_hooks/get_type_check.phpt
M Zend/tests/property_hooks/gh15187_3.phpt
M Zend/tests/property_hooks/gh15644.phpt
M Zend/tests/property_hooks/gh16185_002.phpt
M Zend/tests/property_hooks/gh17101.phpt
M Zend/tests/property_hooks/gh20270.phpt
M Zend/tests/property_hooks/indirect_modification.phpt
M Zend/tests/property_hooks/magic_interaction.phpt
M Zend/tests/property_hooks/override_add_get.phpt
M Zend/tests/property_hooks/override_add_set.phpt
M Zend/tests/property_hooks/parent_get_in_class_with_no_parent.phpt
M Zend/tests/property_hooks/parent_get_plain_typed_uninitialized.phpt
M Zend/tests/property_hooks/parent_get_plain_zpp.phpt
M Zend/tests/property_hooks/parent_get_undefined_property.phpt
M Zend/tests/property_hooks/parent_set_plain_zpp.phpt
M Zend/tests/property_hooks/parent_superfluous_args.phpt
M Zend/tests/property_hooks/parent_wrong_property_info.phpt
M Zend/tests/property_hooks/read_sibling_backing_value.phpt
M Zend/tests/property_hooks/set.phpt
M Zend/tests/property_hooks/unset.phpt
M Zend/tests/property_hooks/virtual_read_write.phpt
M Zend/tests/readonly_classes/gh10377.phpt
M Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt
M Zend/tests/readonly_classes/readonly_class_property1.phpt
M Zend/tests/readonly_classes/readonly_class_property2.phpt
M Zend/tests/readonly_classes/readonly_class_unserialize_error.phpt
M Zend/tests/readonly_props/array_append_initialization.phpt
M Zend/tests/readonly_props/by_ref_foreach.phpt
M Zend/tests/readonly_props/cache_slot.phpt
M Zend/tests/readonly_props/gh7942.phpt
M Zend/tests/readonly_props/initialization_scope.phpt
M Zend/tests/readonly_props/magic_get_set.phpt
M Zend/tests/readonly_props/promotion.phpt
M Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt
M Zend/tests/readonly_props/readonly_clone_error1.phpt
M Zend/tests/readonly_props/readonly_clone_error2.phpt
M Zend/tests/readonly_props/readonly_clone_error3.phpt
M Zend/tests/readonly_props/readonly_clone_error4.phpt
M Zend/tests/readonly_props/readonly_clone_error5.phpt
Diff:
diff --git a/Zend/tests/named_params/cannot_pass_by_ref.phpt b/Zend/tests/named_params/cannot_pass_by_ref.phpt
index a910cd4410c4..dab88481d7ea 100644
--- a/Zend/tests/named_params/cannot_pass_by_ref.phpt
+++ b/Zend/tests/named_params/cannot_pass_by_ref.phpt
@@ -5,9 +5,9 @@ Cannot pass by reference error with named parameters
function test($a, &$e) {}
try {
test(e: 42);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-test(): Argument #2 ($e) could not be passed by reference
+Error: test(): Argument #2 ($e) could not be passed by reference
diff --git a/Zend/tests/named_params/ctor_extra_named_args.phpt b/Zend/tests/named_params/ctor_extra_named_args.phpt
index ae569ea65d39..4617a21192a4 100644
--- a/Zend/tests/named_params/ctor_extra_named_args.phpt
+++ b/Zend/tests/named_params/ctor_extra_named_args.phpt
@@ -7,17 +7,17 @@ class Test {}
try {
new stdClass(x: "nope");
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
new Test(x: "nope");
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Unknown named parameter $x
-Unknown named parameter $x
+Error: Unknown named parameter $x
+Error: Unknown named parameter $x
diff --git a/Zend/tests/named_params/duplicate_param.phpt b/Zend/tests/named_params/duplicate_param.phpt
index 6abc95bba0fb..00f67d4ea1e8 100644
--- a/Zend/tests/named_params/duplicate_param.phpt
+++ b/Zend/tests/named_params/duplicate_param.phpt
@@ -7,17 +7,17 @@ function test($a) {}
try {
test(a: 1, a: 2);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(1, a: 2);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Named parameter $a overwrites previous argument
-Named parameter $a overwrites previous argument
+Error: Named parameter $a overwrites previous argument
+Error: Named parameter $a overwrites previous argument
diff --git a/Zend/tests/named_params/gh17216.phpt b/Zend/tests/named_params/gh17216.phpt
index 4cb4df0ec431..aaaa5c5dce92 100644
--- a/Zend/tests/named_params/gh17216.phpt
+++ b/Zend/tests/named_params/gh17216.phpt
@@ -12,11 +12,11 @@ $callback = [$o, 'trampoline'];
$array = ["a" => "b", 1];
try {
forward_static_call_array($callback, $array);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "Done\n";
?>
--EXPECT--
-Cannot use positional argument after named argument
+Error: Cannot use positional argument after named argument
Done
diff --git a/Zend/tests/named_params/missing_param.phpt b/Zend/tests/named_params/missing_param.phpt
index f8b0b356ceeb..17e2f33c67f4 100644
--- a/Zend/tests/named_params/missing_param.phpt
+++ b/Zend/tests/named_params/missing_param.phpt
@@ -8,20 +8,20 @@ function test($a, $b, $c, $d) {
try {
test(a: 'a', d: 'd');
-} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
array_keys(strict: true);
-} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
array_keys([], strict: true);
-} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// This works fine, as search_value is explicitly specified.
@@ -29,9 +29,9 @@ var_dump(array_keys([41, 42], filter_value: 42, strict: true));
?>
--EXPECT--
-test(): Argument #2 ($b) not passed
-array_keys(): Argument #1 ($array) not passed
-array_keys(): Argument #2 ($filter_value) must be passed explicitly, because the default value is not known
+ArgumentCountError: test(): Argument #2 ($b) not passed
+ArgumentCountError: array_keys(): Argument #1 ($array) not passed
+ArgumentCountError: array_keys(): Argument #2 ($filter_value) must be passed explicitly, because the default value is not known
array(1) {
[0]=>
int(1)
diff --git a/Zend/tests/named_params/unknown_named_param.phpt b/Zend/tests/named_params/unknown_named_param.phpt
index 5a18932ffd17..631776efeba1 100644
--- a/Zend/tests/named_params/unknown_named_param.phpt
+++ b/Zend/tests/named_params/unknown_named_param.phpt
@@ -11,37 +11,37 @@ function test2(...$a) {
try {
test(b: 42);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(b: new stdClass);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(b: 2, a: 1);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(...new ArrayIterator(['unknown' => 42]));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test2(a: 42);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Unknown named parameter $b
-Unknown named parameter $b
-Unknown named parameter $b
-Unknown named parameter $unknown
+Error: Unknown named parameter $b
+Error: Unknown named parameter $b
+Error: Unknown named parameter $b
+Error: Unknown named parameter $unknown
diff --git a/Zend/tests/named_params/unpack.phpt b/Zend/tests/named_params/unpack.phpt
index 92bb4792c3e5..c4eeffb9428f 100644
--- a/Zend/tests/named_params/unpack.phpt
+++ b/Zend/tests/named_params/unpack.phpt
@@ -17,14 +17,14 @@ test(...['a', 'b' => 'b', 'c' => 'c']);
try {
test(...['a', 'b' => 'b', 'c']);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(...['a', 'a' => 'a']);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$ary = ['b' => 0];
@@ -38,14 +38,14 @@ test(...new ArrayIterator(['a', 'b' => 'b', 'c' => 'c']));
try {
test(...new ArrayIterator(['a', 'b' => 'b', 'c']));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test(...new ArrayIterator(['a', 'a' => 'a']));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$ary = ['b' => 0];
@@ -58,8 +58,8 @@ var_dump($ary, $ary2);
a = a, b = b, c = c
a = a, b = b, c = c
a = a, b = b, c = c
-Cannot use positional argument after named argument during unpacking
-Named parameter $a overwrites previous argument
+Error: Cannot use positional argument after named argument during unpacking
+Error: Named parameter $a overwrites previous argument
array(1) {
["b"]=>
int(1)
@@ -71,8 +71,8 @@ array(1) {
a = a, b = b, c = c
a = a, b = b, c = c
a = a, b = b, c = c
-Cannot use positional argument after named argument during unpacking
-Named parameter $a overwrites previous argument
+Error: Cannot use positional argument after named argument during unpacking
+Error: Named parameter $a overwrites previous argument
Warning: Cannot pass by-reference argument 2 of test2() by unpacking a Traversable, passing by-value instead in %s on line %d
array(1) {
diff --git a/Zend/tests/named_params/unpack_and_named_1.phpt b/Zend/tests/named_params/unpack_and_named_1.phpt
index 1e08163724d4..85b407998469 100644
--- a/Zend/tests/named_params/unpack_and_named_1.phpt
+++ b/Zend/tests/named_params/unpack_and_named_1.phpt
@@ -19,13 +19,13 @@ test2(...['b' => 2, 'a' => 1], d: 40);
try {
test2(...[1, 2], b: 20);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
test2(...[1, 'b' => 2], b: 20);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -54,5 +54,5 @@ int(1)
int(2)
int(3)
int(40)
-Named parameter $b overwrites previous argument
-Named parameter $b overwrites previous argument
+Error: Named parameter $b overwrites previous argument
+Error: Named parameter $b overwrites previous argument
diff --git a/Zend/tests/namespaces/ns_076.phpt b/Zend/tests/namespaces/ns_076.phpt
index 230b498b54ac..c033f43a38ed 100644
--- a/Zend/tests/namespaces/ns_076.phpt
+++ b/Zend/tests/namespaces/ns_076.phpt
@@ -7,24 +7,24 @@ use Error;
try {
$a = array(unknown => unknown);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
echo unknown;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
echo \unknown;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Undefined constant "foo\unknown"
-Undefined constant "foo\unknown"
-Undefined constant "unknown"
+Error: Undefined constant "foo\unknown"
+Error: Undefined constant "foo\unknown"
+Error: Undefined constant "unknown"
diff --git a/Zend/tests/not_002.phpt b/Zend/tests/not_002.phpt
index 3282053b6b9d..9027b8d28e82 100644
--- a/Zend/tests/not_002.phpt
+++ b/Zend/tests/not_002.phpt
@@ -8,8 +8,8 @@ $b = array(1,2);
try {
var_dump(~$b);
-} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$a = ~$b;
@@ -18,7 +18,7 @@ var_dump($a);
echo "Done\n";
?>
--EXPECTF--
-Exception: Cannot perform bitwise not on array
+TypeError: Cannot perform bitwise not on array
Fatal error: Uncaught TypeError: Cannot perform bitwise not on array in %s:%d
Stack trace:
diff --git a/Zend/tests/nullsafe_operator/001.phpt b/Zend/tests/nullsafe_operator/001.phpt
index 22776006a717..8e0affeb3ec4 100644
--- a/Zend/tests/nullsafe_operator/001.phpt
+++ b/Zend/tests/nullsafe_operator/001.phpt
@@ -45,7 +45,7 @@ var_dump($foo->self(null?->bar())->null());
try {
var_dump($foo?->self()[null?->bar()]);
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -103,4 +103,4 @@ string(11) "Foo::self()"
string(11) "Foo::null()"
NULL
string(11) "Foo::self()"
-string(38) "Cannot use object of type Foo as array"
+Error: Cannot use object of type Foo as array
diff --git a/Zend/tests/nullsafe_operator/002.phpt b/Zend/tests/nullsafe_operator/002.phpt
index 87642bdcb5f0..19439bdd892d 100644
--- a/Zend/tests/nullsafe_operator/002.phpt
+++ b/Zend/tests/nullsafe_operator/002.phpt
@@ -6,37 +6,37 @@ Test nullsafe strict type check
try {
false?->bar();
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
[]?->bar();
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
(0)?->bar();
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
(0.0)?->bar();
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
''?->bar();
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-string(40) "Call to a member function bar() on false"
-string(40) "Call to a member function bar() on array"
-string(38) "Call to a member function bar() on int"
-string(40) "Call to a member function bar() on float"
-string(41) "Call to a member function bar() on string"
+Error: Call to a member function bar() on false
+Error: Call to a member function bar() on array
+Error: Call to a member function bar() on int
+Error: Call to a member function bar() on float
+Error: Call to a member function bar() on string
diff --git a/Zend/tests/nullsafe_operator/003.phpt b/Zend/tests/nullsafe_operator/003.phpt
index 83c2863d1a10..4164ffab9f97 100644
--- a/Zend/tests/nullsafe_operator/003.phpt
+++ b/Zend/tests/nullsafe_operator/003.phpt
@@ -25,7 +25,7 @@ var_dump($foo?->qux());
try {
var_dump($foo?->quux());
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump((new Foo)?->bar);
@@ -34,7 +34,7 @@ var_dump((new Foo)?->qux());
try {
var_dump((new Foo)?->quux());
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -48,10 +48,10 @@ string(3) "bar"
Warning: Undefined property: Foo::$baz in %s.php on line 20
NULL
string(3) "qux"
-string(36) "Call to undefined method Foo::quux()"
+Error: Call to undefined method Foo::quux()
string(3) "bar"
Warning: Undefined property: Foo::$baz in %s.php on line 29
NULL
string(3) "qux"
-string(36) "Call to undefined method Foo::quux()"
+Error: Call to undefined method Foo::quux()
diff --git a/Zend/tests/nullsafe_operator/013.phpt b/Zend/tests/nullsafe_operator/013.phpt
index ea3539954891..775397a941ad 100644
Binary files a/Zend/tests/nullsafe_operator/013.phpt and b/Zend/tests/nullsafe_operator/013.phpt differ
diff --git a/Zend/tests/nullsafe_operator/014.phpt b/Zend/tests/nullsafe_operator/014.phpt
index 896e831ec9fa..78ee39eebe83 100644
--- a/Zend/tests/nullsafe_operator/014.phpt
+++ b/Zend/tests/nullsafe_operator/014.phpt
@@ -6,8 +6,8 @@ Test nullsafe in binary op
function try_and_dump($fn) {
try {
var_dump($fn());
- } catch (\Error $e) {
- echo $e->getMessage() . "\n";
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -40,8 +40,8 @@ bar
int(0)
bar
int(0)
-Call to a member function null() on null
-Call to a member function null() on null
+Error: Call to a member function null() on null
+Error: Call to a member function null() on null
bar
bar
-Call to a member function baz() on int
+Error: Call to a member function baz() on int
diff --git a/Zend/tests/nullsafe_operator/016.phpt b/Zend/tests/nullsafe_operator/016.phpt
index 5bc8516ae4b9..23149c4070ac 100644
--- a/Zend/tests/nullsafe_operator/016.phpt
+++ b/Zend/tests/nullsafe_operator/016.phpt
@@ -14,13 +14,13 @@ function set(&$ref, $value) {
function test($foo) {
try {
set($foo?->bar, 'bar');
- } catch (Error $e) {
- echo $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
(strrev('tes'))($foo?->bar, 'bar2');
- } catch (Error $e) {
- echo $e->getMessage() . "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -29,7 +29,7 @@ test(new Foo());
?>
--EXPECT--
-set(): Argument #1 ($ref) could not be passed by reference
-set(): Argument #1 ($ref) could not be passed by reference
-set(): Argument #1 ($ref) could not be passed by reference
-set(): Argument #1 ($ref) could not be passed by reference
+Error: set(): Argument #1 ($ref) could not be passed by reference
+Error: set(): Argument #1 ($ref) could not be passed by reference
+Error: set(): Argument #1 ($ref) could not be passed by reference
+Error: set(): Argument #1 ($ref) could not be passed by reference
diff --git a/Zend/tests/nullsafe_operator/026.phpt b/Zend/tests/nullsafe_operator/026.phpt
index c4e825febbc5..cd2ed06884b2 100644
--- a/Zend/tests/nullsafe_operator/026.phpt
+++ b/Zend/tests/nullsafe_operator/026.phpt
@@ -10,17 +10,17 @@ $null = null;
try {
Test::${$null?->foo}->bar;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
Test::{$null?->foo}()->bar;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Access to undeclared static property Test::$
-Method name must be a string
+Error: Access to undeclared static property Test::$
+Error: Method name must be a string
diff --git a/Zend/tests/nullsafe_operator/033.phpt b/Zend/tests/nullsafe_operator/033.phpt
index 63ee2f850a56..58579d325e04 100644
--- a/Zend/tests/nullsafe_operator/033.phpt
+++ b/Zend/tests/nullsafe_operator/033.phpt
@@ -25,7 +25,7 @@ var_dump("{$foo?->qux()}");
try {
var_dump("{$foo?->quux()}");
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump("$foo?->bar");
@@ -34,7 +34,7 @@ var_dump("$foo?->qux()");
try {
var_dump("$foo?->quux()");
} catch (Throwable $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -48,7 +48,7 @@ string(3) "bar"
Warning: Undefined property: Foo::$baz in %s.php on line 20
string(0) ""
string(3) "qux"
-string(36) "Call to undefined method Foo::quux()"
+Error: Call to undefined method Foo::quux()
string(3) "bar"
Warning: Undefined property: Foo::$baz in %s.php on line 29
diff --git a/Zend/tests/nullsafe_operator/039.phpt b/Zend/tests/nullsafe_operator/039.phpt
index 92983c1592e0..4189b85dfea4 100644
--- a/Zend/tests/nullsafe_operator/039.phpt
+++ b/Zend/tests/nullsafe_operator/039.phpt
@@ -9,10 +9,10 @@ set_error_handler(function($_, $m) {
try {
$foo?->foo;
-} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Undefined variable $foo
+Exception: Undefined variable $foo
diff --git a/Zend/tests/nullsafe_operator/constant_propagation.phpt b/Zend/tests/nullsafe_operator/constant_propagation.phpt
index e41201d0e496..f6f9b616d7c0 100644
--- a/Zend/tests/nullsafe_operator/constant_propagation.phpt
+++ b/Zend/tests/nullsafe_operator/constant_propagation.phpt
@@ -7,10 +7,10 @@ class Bar { const FOO = "foo"; }
try {
Bar::FOO?->length();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Call to a member function length() on string
+Error: Call to a member function length() on string
diff --git a/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt b/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt
index 51df22634869..a76e26cae6dc 100644
--- a/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt
+++ b/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt
@@ -15,8 +15,8 @@ try {
$a = foxcache("dolor");
$a += "sit";
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
$a = foxcache("5 amet,");
@@ -26,8 +26,8 @@ try {
$a = foxcache("adipiscing");
$a -= "elit,";
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
$a = foxcache("11 sed");
@@ -37,8 +37,8 @@ try {
$a = foxcache("eiusmod");
$a *= "tempor";
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
$a = foxcache("17 incididunt");
@@ -48,8 +48,8 @@ try {
$a = foxcache("labore");
$a /= "et";
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
$a = foxcache("23 dolore");
@@ -59,8 +59,8 @@ try {
$a = foxcache("aliqua.");
$a **= "Ut";
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
$a = foxcache("31 enim");
@@ -70,8 +70,8 @@ try {
$a = foxcache("minim");
$a %= "veniam,";
var_dump($a);
-} catch (\TypeError $e) {
- echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
$a = foxcache("41 minim");
@@ -80,8 +80,8 @@ try {
var_dump($a);
$a = foxcache("quis");
$a <<= "nostrud";
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($a);
echo "---", PHP_EOL;
@@ -92,8 +92,8 @@ try {
$a = foxcache("laboris");
$a >>= "nisi";
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
$a = foxcache("59 ut");
@@ -106,15 +106,15 @@ try {
$a = foxcache("ex");
$a |= 73;
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$a = foxcache(79);
$a |= "ea";
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
$a = foxcache("83 commodo");
@@ -127,15 +127,15 @@ try {
$a = foxcache("Duis");
$a &= 103;
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$a = foxcache(107);
$a &= "aute";
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
$a = foxcache("109 irure");
@@ -148,15 +148,15 @@ try {
$a = foxcache("in");
$a ^= 137;
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$a = foxcache(139);
$a ^= "reprehenderit";
var_dump($a);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
@@ -164,35 +164,35 @@ Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(5)
-Unsupported operand types: string + string
+TypeError: Unsupported operand types: string + string
---
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(-2)
-Unsupported operand types: string - string
+TypeError: Unsupported operand types: string - string
---
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(143)
-Unsupported operand types: string * string
+TypeError: Unsupported operand types: string * string
---
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
float(0.8947368421052632)
-Unsupported operand types: string / string
+TypeError: Unsupported operand types: string / string
---
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
float(3.0910586430935376E+39)
-Unsupported operand types: string ** string
+TypeError: Unsupported operand types: string ** string
---
Warning: A non-numeric value encountered in %s on line %d
@@ -206,7 +206,7 @@ Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(%d)
-Unsupported operand types: string << string
+TypeError: Unsupported operand types: string << string
string(4) "quis"
---
@@ -214,7 +214,7 @@ Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(0)
-Unsupported operand types: string >> string
+TypeError: Unsupported operand types: string >> string
---
Warning: A non-numeric value encountered in %s on line %d
@@ -222,8 +222,8 @@ int(63)
Warning: A non-numeric value encountered in %s on line %d
int(71)
-Unsupported operand types: string | int
-Unsupported operand types: int | string
+TypeError: Unsupported operand types: string | int
+TypeError: Unsupported operand types: int | string
---
Warning: A non-numeric value encountered in %s on line %d
@@ -231,8 +231,8 @@ int(81)
Warning: A non-numeric value encountered in %s on line %d
int(97)
-Unsupported operand types: string & int
-Unsupported operand types: int & string
+TypeError: Unsupported operand types: string & int
+TypeError: Unsupported operand types: int & string
---
Warning: A non-numeric value encountered in %s on line %d
@@ -240,5 +240,5 @@ int(28)
Warning: A non-numeric value encountered in %s on line %d
int(252)
-Unsupported operand types: string ^ int
-Unsupported operand types: int ^ string
+TypeError: Unsupported operand types: string ^ int
+TypeError: Unsupported operand types: int ^ string
diff --git a/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt b/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
index 2b76f538f46e..ff3202e2c29d 100644
--- a/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
+++ b/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
@@ -6,110 +6,110 @@ Invalid numeric string TypeErrors and E_WARNINGs
var_dump("2 Lorem" + "3 ipsum");
try {
var_dump("dolor" + "sit");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("5 amet," - "7 consectetur");
try {
var_dump("adipiscing" - "elit,");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("11 sed" * "13 do");
try {
var_dump("eiusmod" * "tempor");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("17 incididunt" / "19 ut");
try {
var_dump("labore" / "et");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("23 dolore" ** "29 magna");
try {
var_dump("aliqua." ** "Ut");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("31 enim" % "37 ad");
try {
var_dump("minim" % "veniam,");
-} catch (\TypeError $e) {
- echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("41 minim" << "43 veniam,");
try {
var_dump("quis" << "nostrud");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("47 exercitation" >> "53 ullamco");
try {
var_dump("laboris" >> "nisi");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("59 ut" | 61);
var_dump(67 | "71 aliquip");
try {
var_dump("ex" | 73);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(79 | "ea");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("83 commodo" & 89);
var_dump(97 & "101 consequat.");
try {
var_dump("Duis" & 103);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(107 & "aute");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump("109 irure" ^ 113);
var_dump(127 ^ "131 dolor");
try {
var_dump("in" ^ 137);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(139 ^ "reprehenderit");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump(+"149 in");
try {
var_dump(+"voluptate");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "---", PHP_EOL;
var_dump(-"151 velit");
try {
var_dump(-"esse");
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
@@ -117,35 +117,35 @@ Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(5)
-Unsupported operand types: string + string
+TypeError: Unsupported operand types: string + string
---
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(-2)
-Unsupported operand types: string - string
+TypeError: Unsupported operand types: string - string
---
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(143)
-Unsupported operand types: string * string
+TypeError: Unsupported operand types: string * string
---
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
float(0.8947368421052632)
-Unsupported operand types: string / string
+TypeError: Unsupported operand types: string / string
---
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
float(3.0910586430935376E+39)
-Unsupported operand types: string ** string
+TypeError: Unsupported operand types: string ** string
---
Warning: A non-numeric value encountered in %s on line %d
@@ -159,14 +159,14 @@ Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(%d)
-Unsupported operand types: string << string
+TypeError: Unsupported operand types: string << string
---
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(0)
-Unsupported operand types: string >> string
+TypeError: Unsupported operand types: string >> string
---
Warning: A non-numeric value encountered in %s on line %d
@@ -174,8 +174,8 @@ int(63)
Warning: A non-numeric value encountered in %s on line %d
int(71)
-Unsupported operand types: string | int
-Unsupported operand types: int | string
+TypeError: Unsupported operand types: string | int
+TypeError: Unsupported operand types: int | string
---
Warning: A non-numeric value encountered in %s on line %d
@@ -183,8 +183,8 @@ int(81)
Warning: A non-numeric value encountered in %s on line %d
int(97)
-Unsupported operand types: string & int
-Unsupported operand types: int & string
+TypeError: Unsupported operand types: string & int
+TypeError: Unsupported operand types: int & string
---
Warning: A non-numeric value encountered in %s on line %d
@@ -192,15 +192,15 @@ int(28)
Warning: A non-numeric value encountered in %s on line %d
int(252)
-Unsupported operand types: string ^ int
-Unsupported operand types: int ^ string
+TypeError: Unsupported operand types: string ^ int
+TypeError: Unsupported operand types: int ^ string
---
Warning: A non-numeric value encountered in %s on line %d
int(149)
-Unsupported operand types: string * int
+TypeError: Unsupported operand types: string * int
---
Warning: A non-numeric value encountered in %s on line %d
int(-151)
-Unsupported operand types: string * int
+TypeError: Unsupported operand types: string * int
diff --git a/Zend/tests/numeric_strings/string_offset.phpt b/Zend/tests/numeric_strings/string_offset.phpt
index 0c43bc151210..4516cb24f80a 100644
--- a/Zend/tests/numeric_strings/string_offset.phpt
+++ b/Zend/tests/numeric_strings/string_offset.phpt
@@ -30,8 +30,8 @@ $keys = [
foreach ($keys as $key) {
try {
var_dump($str[$key]);
- } catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -39,29 +39,29 @@ echo "Done\n";
?>
--EXPECTF--
string(1) "l"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
string(1) "l"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
string(1) "l"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
string(1) "l"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
Warning: Illegal string offset "7str" in %s on line %d
string(1) "l"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
Warning: Illegal string offset " 7str" in %s on line %d
string(1) "l"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
Warning: Illegal string offset " 7 str" in %s on line %d
string(1) "l"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
Warning: Illegal string offset "7 str" in %s on line %d
string(1) "l"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
Warning: Illegal string offset "0xC" in %s on line %d
string(1) "T"
diff --git a/Zend/tests/offset_array.phpt b/Zend/tests/offset_array.phpt
index e50ffad18cb2..e58701b94eb2 100644
--- a/Zend/tests/offset_array.phpt
+++ b/Zend/tests/offset_array.phpt
@@ -19,15 +19,15 @@ var_dump($arr[$fp]);
$obj = new stdClass;
try {
var_dump($arr[$obj]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$arr1 = Array(1,2,3);
try {
var_dump($arr[$arr1]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "Done\n";
@@ -50,6 +50,6 @@ int(1)
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
int(%d)
-Cannot access offset of type stdClass on array
-Cannot access offset of type array on array
+TypeError: Cannot access offset of type stdClass on array
+TypeError: Cannot access offset of type array on array
Done
diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt
index a32a68265689..c979b5a3613b 100644
--- a/Zend/tests/offset_string.phpt
+++ b/Zend/tests/offset_string.phpt
@@ -10,14 +10,14 @@ var_dump($str[0.0836]);
var_dump($str[NULL]);
try {
var_dump($str["run away"]);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($str["13"]);
try {
var_dump($str["14.5"]);
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($str["15 and then some"]);
@@ -27,22 +27,22 @@ var_dump($str[FALSE]);
$fp = fopen(__FILE__, "r");
try {
var_dump($str[$fp]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$obj = new stdClass;
try {
var_dump($str[$obj]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$arr = Array(1,2,3);
try {
var_dump($str[$arr]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "Done\n";
@@ -55,9 +55,9 @@ string(1) "S"
Warning: String offset cast occurred in %s on line %d
string(1) "S"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
string(1) "c"
-Cannot access offset of type string on string
+TypeError: Cannot access offset of type string on string
Warning: Illegal string offset "15 and then some" in %s on line %d
string(1) "r"
@@ -67,7 +67,7 @@ string(1) "i"
Warning: String offset cast occurred in %s on line %d
string(1) "S"
-Cannot access offset of type resource on string
-Cannot access offset of type stdClass on string
-Cannot access offset of type array on string
+TypeError: Cannot access offset of type resource on string
+TypeError: Cannot access offset of type stdClass on string
+TypeError: Cannot access offset of type array on string
Done
diff --git a/Zend/tests/offsets/appending_containers.phpt b/Zend/tests/offsets/appending_containers.phpt
index 0372c28bf184..85eb50812468 100644
--- a/Zend/tests/offsets/appending_containers.phpt
+++ b/Zend/tests/offsets/appending_containers.phpt
@@ -11,7 +11,7 @@ foreach ($containers as $container) {
$container[] = 'value';
var_dump($container);
} catch (\Throwable $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -30,26 +30,26 @@ array(1) {
string(5) "value"
}
true container:
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
4 container:
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
5.5 container:
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
'10' container:
-[] operator not supported for strings
+Error: [] operator not supported for strings
'25.5' container:
-[] operator not supported for strings
+Error: [] operator not supported for strings
'string' container:
-[] operator not supported for strings
+Error: [] operator not supported for strings
[] container:
array(1) {
[0]=>
string(5) "value"
}
STDERR container:
-Cannot use a scalar value as an array
+Error: Cannot use a scalar value as an array
new stdClass() container:
-Cannot use object of type stdClass as array
+Error: Cannot use object of type stdClass as array
new ArrayObject() container:
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
diff --git a/Zend/tests/oss_fuzz_434346548.phpt b/Zend/tests/oss_fuzz_434346548.phpt
index 139e36758bc4..26f10ccb9894 100644
--- a/Zend/tests/oss_fuzz_434346548.phpt
+++ b/Zend/tests/oss_fuzz_434346548.phpt
@@ -13,10 +13,10 @@ function test($y = new Foo() < "") {
try {
test();
-} catch (Error $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/pipe_operator/ast.phpt b/Zend/tests/pipe_operator/ast.phpt
index e8c088dabfdb..32e06f1ff10b 100644
--- a/Zend/tests/pipe_operator/ast.phpt
+++ b/Zend/tests/pipe_operator/ast.phpt
@@ -7,76 +7,76 @@ print "Concat, which binds higher\n";
try {
assert(false && foo() . bar() |> baz() . quux());
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && (foo() . bar()) |> baz() . quux());
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && foo() . (bar() |> baz()) . quux());
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && foo() . bar() |> (baz() . quux()));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && (foo() . bar() |> baz()) . quux());
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && foo() . (bar() |> baz() . quux()));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
print "<, which binds lower\n";
try {
assert(false && foo() < bar() |> baz());
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && (foo() < bar()) |> baz());
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && foo() < (bar() |> baz()));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && foo() |> bar() < baz());
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && (foo() |> bar()) < baz());
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
assert(false && foo() |> (bar() < baz()));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
@@ -85,25 +85,25 @@ print "misc examples\n";
try {
assert(false && foo() |> (bar() |> baz(...)));
-} catch (AssertionError $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
Concat, which binds higher
-assert(false && foo() . bar() |> baz() . quux())
-assert(false && foo() . bar() |> baz() . quux())
-assert(false && foo() . (bar() |> baz()) . quux())
-assert(false && foo() . bar() |> baz() . quux())
-assert(false && (foo() . bar() |> baz()) . quux())
-assert(false && foo() . (bar() |> baz() . quux()))
+AssertionError: assert(false && foo() . bar() |> baz() . quux())
+AssertionError: assert(false && foo() . bar() |> baz() . quux())
+AssertionError: assert(false && foo() . (bar() |> baz()) . quux())
+AssertionError: assert(false && foo() . bar() |> baz() . quux())
+AssertionError: assert(false && (foo() . bar() |> baz()) . quux())
+AssertionError: assert(false && foo() . (bar() |> baz() . quux()))
<, which binds lower
-assert(false && foo() < bar() |> baz())
-assert(false && (foo() < bar()) |> baz())
-assert(false && foo() < bar() |> baz())
-assert(false && foo() |> bar() < baz())
-assert(false && foo() |> bar() < baz())
-assert(false && foo() |> (bar() < baz()))
+AssertionError: assert(false && foo() < bar() |> baz())
+AssertionError: assert(false && (foo() < bar()) |> baz())
+AssertionError: assert(false && foo() < bar() |> baz())
+AssertionError: assert(false && foo() |> bar() < baz())
+AssertionError: assert(false && foo() |> bar() < baz())
+AssertionError: assert(false && foo() |> (bar() < baz()))
misc examples
-assert(false && foo() |> (bar() |> baz(...)))
+AssertionError: assert(false && foo() |> (bar() |> baz(...)))
diff --git a/Zend/tests/pipe_operator/call_by_ref.phpt b/Zend/tests/pipe_operator/call_by_ref.phpt
index 026089b0a654..052db32ea7b7 100644
--- a/Zend/tests/pipe_operator/call_by_ref.phpt
+++ b/Zend/tests/pipe_operator/call_by_ref.phpt
@@ -17,8 +17,8 @@ try {
$a = 5;
$res1 = $a |> _modify(...);
var_dump($res1);
-} catch (\Error $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Complex variables.
@@ -26,12 +26,12 @@ try {
$a = ['foo' => 'beep'];
$res2 = $a |> _append(...);
var_dump($res2);
-} catch (\Error $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-_modify(): Argument #1 ($a) could not be passed by reference
-_append(): Argument #1 ($a) could not be passed by reference
+Error: _modify(): Argument #1 ($a) could not be passed by reference
+Error: _append(): Argument #1 ($a) could not be passed by reference
diff --git a/Zend/tests/pipe_operator/call_prefer_by_ref.phpt b/Zend/tests/pipe_operator/call_prefer_by_ref.phpt
index 31750ac280d7..6476105fdad8 100644
--- a/Zend/tests/pipe_operator/call_prefer_by_ref.phpt
+++ b/Zend/tests/pipe_operator/call_prefer_by_ref.phpt
@@ -8,8 +8,8 @@ $a = ['hello', 'world'];
try {
$r = $a |> array_multisort(...);
var_dump($r);
-} catch (\Error $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
diff --git a/Zend/tests/pipe_operator/oss_fuzz_427814452.phpt b/Zend/tests/pipe_operator/oss_fuzz_427814452.phpt
index 2ecfbab6348f..00c868483484 100644
--- a/Zend/tests/pipe_operator/oss_fuzz_427814452.phpt
+++ b/Zend/tests/pipe_operator/oss_fuzz_427814452.phpt
@@ -5,22 +5,22 @@ OSS-Fuzz #427814452
try {
false |> assert(...);
-} catch (\AssertionError $e) {
- echo $e::class, ": '", $e->getMessage(), "'\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': "', $e->getMessage(), '"', "\n";
}
try {
0 |> "assert"(...);
-} catch (\AssertionError $e) {
- echo $e::class, ": '", $e->getMessage(), "'\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': "', $e->getMessage(), '"', "\n";
}
try {
false |> ("a"."ssert")(...);
-} catch (\AssertionError $e) {
- echo $e::class, ": '", $e->getMessage(), "'\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': "', $e->getMessage(), '"', "\n";
}
?>
--EXPECT--
-AssertionError: ''
-AssertionError: ''
-AssertionError: ''
+AssertionError: ""
+AssertionError: ""
+AssertionError: ""
diff --git a/Zend/tests/pipe_operator/prec_005.phpt b/Zend/tests/pipe_operator/prec_005.phpt
index 0dd262324e3d..c711393502a2 100644
--- a/Zend/tests/pipe_operator/prec_005.phpt
+++ b/Zend/tests/pipe_operator/prec_005.phpt
@@ -5,10 +5,10 @@ Pipe precedence 005
try {
assert(false && 1 |> (fn() => 2));
-} catch (AssertionError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(false && 1 |> (fn() => 2))
+AssertionError: assert(false && 1 |> (fn() => 2))
diff --git a/Zend/tests/pow_array_leak.phpt b/Zend/tests/pow_array_leak.phpt
index 06dce0ac6a2b..be7bf6b0638b 100644
--- a/Zend/tests/pow_array_leak.phpt
+++ b/Zend/tests/pow_array_leak.phpt
@@ -6,27 +6,27 @@ Memory leak on ** with result==op1 array
$x = [0];
try {
$x **= 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($x);
$x = [0];
try {
$x **= $x;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($x);
?>
--EXPECT--
-Unsupported operand types: array ** int
+TypeError: Unsupported operand types: array ** int
array(1) {
[0]=>
int(0)
}
-Unsupported operand types: array ** array
+TypeError: Unsupported operand types: array ** array
array(1) {
[0]=>
int(0)
diff --git a/Zend/tests/prop_const_expr/non_enums_rhs.phpt b/Zend/tests/prop_const_expr/non_enums_rhs.phpt
index 0bffe9d8e02f..57ac29257cbb 100644
--- a/Zend/tests/prop_const_expr/non_enums_rhs.phpt
+++ b/Zend/tests/prop_const_expr/non_enums_rhs.phpt
@@ -12,8 +12,8 @@ function foo($prop = (new A)->prop) {}
function test() {
try {
foo();
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -22,5 +22,5 @@ test();
?>
--EXPECT--
-Fetching properties on non-enums in constant expressions is not allowed
-Fetching properties on non-enums in constant expressions is not allowed
+Error: Fetching properties on non-enums in constant expressions is not allowed
+Error: Fetching properties on non-enums in constant expressions is not allowed
diff --git a/Zend/tests/property_access_errors_for_guarded_properties.phpt b/Zend/tests/property_access_errors_for_guarded_properties.phpt
index 0a360a9447d7..8cc6202097d5 100644
--- a/Zend/tests/property_access_errors_for_guarded_properties.phpt
+++ b/Zend/tests/property_access_errors_for_guarded_properties.phpt
@@ -34,22 +34,22 @@ class Test {
$test = new Test;
try {
$test->prop = "bar";
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($test->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
unset($test->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot access private property Test::$prop
-Cannot access private property Test::$prop
-Cannot access private property Test::$prop
+Error: Cannot access private property Test::$prop
+Error: Cannot access private property Test::$prop
+Error: Cannot access private property Test::$prop
diff --git a/Zend/tests/property_exists_basic.phpt b/Zend/tests/property_exists_basic.phpt
index 8412699e026b..4ef9358e9864 100644
--- a/Zend/tests/property_exists_basic.phpt
+++ b/Zend/tests/property_exists_basic.phpt
@@ -42,28 +42,28 @@ var_dump(property_exists($foo,""));
try {
var_dump(property_exists(array(), "test"));
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(property_exists(1, "test"));
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(property_exists(3.14, "test"));
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(property_exists(true, "test"));
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(property_exists(null, "test"));
-} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$foo->bar();
@@ -86,11 +86,11 @@ bool(true)
bool(true)
bool(false)
bool(false)
-property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given
-property_exists(): Argument #1 ($object_or_class) must be of type object|string, int given
-property_exists(): Argument #1 ($object_or_class) must be of type object|string, float given
-property_exists(): Argument #1 ($object_or_class) must be of type object|string, true given
-property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
+TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given
+TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, int given
+TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, true given
+TypeError: property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
bool(true)
bool(true)
bool(true)
diff --git a/Zend/tests/property_hooks/ast_printing.phpt b/Zend/tests/property_hooks/ast_printing.phpt
index 128a84964016..9153f4996210 100644
--- a/Zend/tests/property_hooks/ast_printing.phpt
+++ b/Zend/tests/property_hooks/ast_printing.phpt
@@ -19,13 +19,13 @@ try {
get => 42;
}
});
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(false && new class {
+AssertionError: assert(false && new class {
public $prop1 {
get;
set;
diff --git a/Zend/tests/property_hooks/backed_delegated_read_write.phpt b/Zend/tests/property_hooks/backed_delegated_read_write.phpt
index df85768fe516..63910574bf75 100644
--- a/Zend/tests/property_hooks/backed_delegated_read_write.phpt
+++ b/Zend/tests/property_hooks/backed_delegated_read_write.phpt
@@ -45,14 +45,14 @@ $test = new Test;
try {
$test->prop = 0;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($test->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$child = new Child();
@@ -61,6 +61,6 @@ var_dump($child->prop2);
?>
--EXPECTF--
-Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
-Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
+Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
+Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
int(43)
diff --git a/Zend/tests/property_hooks/bug001.phpt b/Zend/tests/property_hooks/bug001.phpt
index 62291019b333..280f2a0791b9 100644
--- a/Zend/tests/property_hooks/bug001.phpt
+++ b/Zend/tests/property_hooks/bug001.phpt
@@ -20,11 +20,11 @@ $c = new C;
try {
$c->x = 3;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
bool(true)
-Cannot write to get-only virtual property C::$x
+Error: Cannot write to get-only virtual property C::$x
diff --git a/Zend/tests/property_hooks/cache.phpt b/Zend/tests/property_hooks/cache.phpt
index dedbfa48f4ac..0409c92a2b13 100644
--- a/Zend/tests/property_hooks/cache.phpt
+++ b/Zend/tests/property_hooks/cache.phpt
@@ -18,15 +18,15 @@ function doTest(Test $test) {
$test->prop = [];
try {
$test->prop[] = 1;
- } catch (\Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
isset($test->prop);
isset($test->prop[0]);
try {
unset($test->prop);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -46,10 +46,10 @@ Test::$prop::get
Test::$prop::set
Test::$prop::set
Test::$prop::get
-Indirect modification of Test::$prop is not allowed
+Error: Indirect modification of Test::$prop is not allowed
Test::$prop::get
Test::$prop::get
-Cannot unset hooked property Test::$prop
+Error: Cannot unset hooked property Test::$prop
Test::$prop::set
Test::$prop::get
@@ -58,7 +58,7 @@ Test::$prop::get
Test::$prop::set
Test::$prop::set
Test::$prop::get
-Indirect modification of Test::$prop is not allowed
+Error: Indirect modification of Test::$prop is not allowed
Test::$prop::get
Test::$prop::get
-Cannot unset hooked property Test::$prop
+Error: Cannot unset hooked property Test::$prop
diff --git a/Zend/tests/property_hooks/default_value_inheritance.phpt b/Zend/tests/property_hooks/default_value_inheritance.phpt
index 3821e19634e7..81fc5d2d0ace 100644
--- a/Zend/tests/property_hooks/default_value_inheritance.phpt
+++ b/Zend/tests/property_hooks/default_value_inheritance.phpt
@@ -28,14 +28,14 @@ function test(P $p) {
var_dump($p->a);
try {
var_dump($p->b);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($p->c);
try {
var_dump($p->d);
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
@@ -45,10 +45,10 @@ test(new GC);
?>
--EXPECT--
NULL
-Typed property C::$b must not be accessed before initialization
+Error: Typed property C::$b must not be accessed before initialization
int(2)
int(2)
NULL
-Typed property GC::$b must not be accessed before initialization
+Error: Typed property GC::$b must not be accessed before initialization
NULL
-Typed property GC::$d must not be accessed before initialization
+Error: Typed property GC::$d must not be accessed before initialization
diff --git a/Zend/tests/property_hooks/direct_hook_call.phpt b/Zend/tests/property_hooks/direct_hook_call.phpt
index d97ef4c469a4..6a09bb115e51 100644
--- a/Zend/tests/property_hooks/direct_hook_call.phpt
+++ b/Zend/tests/property_hooks/direct_hook_call.phpt
@@ -13,16 +13,16 @@ class Test {
$test = new Test;
try {
$test->{'$prop::get'}();
-} catch (\Error $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->{'$prop::set'}('foo');
-} catch (\Error $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Call to undefined method Test::$prop::get()
-Call to undefined method Test::$prop::set()
+Error: Call to undefined method Test::$prop::get()
+Error: Call to undefined method Test::$prop::set()
diff --git a/Zend/tests/property_hooks/final_prop_promoted_ast.phpt b/Zend/tests/property_hooks/final_prop_promoted_ast.phpt
index 32aa1f27dc32..a442c879dc26 100644
--- a/Zend/tests/property_hooks/final_prop_promoted_ast.phpt
+++ b/Zend/tests/property_hooks/final_prop_promoted_ast.phpt
@@ -6,12 +6,12 @@ try {
assert(false && new class {
public function __construct(public final $prop) {}
});
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(false && new class {
+AssertionError: assert(false && new class {
public function __construct(public final $prop) {
}
diff --git a/Zend/tests/property_hooks/foreach_val_to_ref.phpt b/Zend/tests/property_hooks/foreach_val_to_ref.phpt
index dba71412579f..a5a64c0950ba 100644
--- a/Zend/tests/property_hooks/foreach_val_to_ref.phpt
+++ b/Zend/tests/property_hooks/foreach_val_to_ref.phpt
@@ -24,11 +24,11 @@ function test($object) {
try {
test(new ByVal);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
int(42)
-Cannot create reference to property ByVal::$byVal
+Error: Cannot create reference to property ByVal::$byVal
diff --git a/Zend/tests/property_hooks/get.phpt b/Zend/tests/property_hooks/get.phpt
index 6d4b005843ea..7c4923c86452 100644
--- a/Zend/tests/property_hooks/get.phpt
+++ b/Zend/tests/property_hooks/get.phpt
@@ -14,11 +14,11 @@ var_dump($test->prop);
try {
$test->prop = 0;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
int(42)
-Cannot write to get-only virtual property Test::$prop
+Error: Cannot write to get-only virtual property Test::$prop
diff --git a/Zend/tests/property_hooks/get_by_ref.phpt b/Zend/tests/property_hooks/get_by_ref.phpt
index f602721a791d..b35be8751bfa 100644
--- a/Zend/tests/property_hooks/get_by_ref.phpt
+++ b/Zend/tests/property_hooks/get_by_ref.phpt
@@ -15,20 +15,20 @@ $test = new Test;
try {
$test->byVal = [];
$test->byVal[] = 42;
-} catch (\Error $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->byVal);
try {
$test->byVal =& $ref;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Indirect modification of Test::$byVal is not allowed
+Error: Indirect modification of Test::$byVal is not allowed
array(0) {
}
-Cannot assign by reference to overloaded object
+Error: Cannot assign by reference to overloaded object
diff --git a/Zend/tests/property_hooks/get_by_ref_auto.phpt b/Zend/tests/property_hooks/get_by_ref_auto.phpt
index 0dabe4c45211..7e0be4e38d92 100644
--- a/Zend/tests/property_hooks/get_by_ref_auto.phpt
+++ b/Zend/tests/property_hooks/get_by_ref_auto.phpt
@@ -11,15 +11,15 @@ $test = new Test;
try {
$test->byVal[] = 42;
-} catch (\Error $e) {
- echo get_class($e) . ': ' . $e->getMessage() . "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->byVal);
try {
$test->byVal =& $ref;
-} catch (Error $e) {
- echo get_class($e) . ': ' . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
diff --git a/Zend/tests/property_hooks/get_type_check.phpt b/Zend/tests/property_hooks/get_type_check.phpt
index 2e0e9b9fcf6e..0302e3aa7694 100644
--- a/Zend/tests/property_hooks/get_type_check.phpt
+++ b/Zend/tests/property_hooks/get_type_check.phpt
@@ -15,12 +15,12 @@ class Test {
$test = new Test;
try {
var_dump($test->prop1);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->prop2);
?>
--EXPECT--
-Test::$prop1::get(): Return value must be of type int, string returned
+TypeError: Test::$prop1::get(): Return value must be of type int, string returned
int(42)
diff --git a/Zend/tests/property_hooks/gh15187_3.phpt b/Zend/tests/property_hooks/gh15187_3.phpt
index d82e6002f82b..c8d8131de8a1 100644
--- a/Zend/tests/property_hooks/gh15187_3.phpt
+++ b/Zend/tests/property_hooks/gh15187_3.phpt
@@ -17,8 +17,8 @@ foreach ($c as $k => &$v) {
if ($k === 'c') {
try {
$v = 'foo';
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
if ($k === 'd') {
@@ -31,7 +31,7 @@ var_dump($c);
?>
--EXPECTF--
int(1)
-Cannot assign string to reference held by property C::$c of type int
+TypeError: Cannot assign string to reference held by property C::$c of type int
int(2)
object(C)#%d (2) {
["b"]=>
diff --git a/Zend/tests/property_hooks/gh15644.phpt b/Zend/tests/property_hooks/gh15644.phpt
index 1e0dda3a0e44..136fc8cc587c 100644
--- a/Zend/tests/property_hooks/gh15644.phpt
+++ b/Zend/tests/property_hooks/gh15644.phpt
@@ -16,17 +16,17 @@ $c = new C();
try {
$c->prop1 = 'hello world';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$c->prop2 = 'hello world';
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot modify private(set) property C::$prop1 from global scope
-Cannot modify private(set) property C::$prop2 from global scope
+Error: Cannot modify private(set) property C::$prop1 from global scope
+Error: Cannot modify private(set) property C::$prop2 from global scope
diff --git a/Zend/tests/property_hooks/gh16185_002.phpt b/Zend/tests/property_hooks/gh16185_002.phpt
index 39edba438b04..3154873a0620 100644
--- a/Zend/tests/property_hooks/gh16185_002.phpt
+++ b/Zend/tests/property_hooks/gh16185_002.phpt
@@ -21,10 +21,10 @@ $c->init();
try {
foreach ($c as &$prop) {}
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-Cannot acquire reference to readonly property C::$prop
+Error: Cannot acquire reference to readonly property C::$prop
diff --git a/Zend/tests/property_hooks/gh17101.phpt b/Zend/tests/property_hooks/gh17101.phpt
index 3ab53fb75da0..d6179f763f3e 100644
--- a/Zend/tests/property_hooks/gh17101.phpt
+++ b/Zend/tests/property_hooks/gh17101.phpt
@@ -7,13 +7,13 @@ try {
assert(false && new class {
public function __construct( #[Foo] public private(set) bool $boolVal = false { final set => $this->boolVal = 1;} ) {}
});
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-assert(false && new class {
+AssertionError: assert(false && new class {
public function __construct(#[Foo] public private(set) bool $boolVal = false {
final set => $this->boolVal = 1;
}) {
diff --git a/Zend/tests/property_hooks/gh20270.phpt b/Zend/tests/property_hooks/gh20270.phpt
index 173d21990e55..b2df80519646 100644
--- a/Zend/tests/property_hooks/gh20270.phpt
+++ b/Zend/tests/property_hooks/gh20270.phpt
@@ -31,21 +31,21 @@ $b = new B();
try {
$b->prop1 = 0;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($b->prop1);
try {
$b->prop2 = 0;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($b->prop2);
?>
--EXPECT--
-Unknown named parameter $unknown
+Error: Unknown named parameter $unknown
int(42)
-Unknown named parameter $value
+Error: Unknown named parameter $value
int(42)
diff --git a/Zend/tests/property_hooks/indirect_modification.phpt b/Zend/tests/property_hooks/indirect_modification.phpt
index 2fb8bda77a24..198892adfae6 100644
--- a/Zend/tests/property_hooks/indirect_modification.phpt
+++ b/Zend/tests/property_hooks/indirect_modification.phpt
@@ -23,14 +23,14 @@ var_dump($test->byVal);
$test->byVal = [];
try {
$test->byVal[] = 1;
-} catch (\Error $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->byVal);
try {
$ref =& $test->byVal;
-} catch (\Error $e) {
- echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$ref = 42;
var_dump($test->byVal);
@@ -43,9 +43,9 @@ Test::$byVal::set
Test::$byVal::set
int(3)
Test::$byVal::set
-Indirect modification of Test::$byVal is not allowed
+Error: Indirect modification of Test::$byVal is not allowed
array(0) {
}
-Indirect modification of Test::$byVal is not allowed
+Error: Indirect modification of Test::$byVal is not allowed
array(0) {
}
diff --git a/Zend/tests/property_hooks/magic_interaction.phpt b/Zend/tests/property_hooks/magic_interaction.phpt
index 7ea9e60f8969..b2b31750fad5 100644
--- a/Zend/tests/property_hooks/magic_interaction.phpt
+++ b/Zend/tests/property_hooks/magic_interaction.phpt
@@ -18,24 +18,24 @@ class B extends A {
echo __METHOD__, "($name)\n";
try {
$this->$name;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
public function __set($name, $value) {
echo __METHOD__, "($name, $value)\n";
try {
$this->$name = $value;
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
public function __isset($name) {
echo __METHOD__, "($name)\n";
try {
var_dump(isset($this->$name));
- } catch (Error $e) {
- echo $e->getMessage(), "\n";
+ } catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
public function __unset($name) {
@@ -49,8 +49,8 @@ var_dump(isset($b->prop));
$b->prop = 1;
try {
unset($b->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -59,4 +59,4 @@ A::$prop::get
A::$prop::get
bool(true)
A::$prop::set
-Cannot unset hooked property B::$prop
+Error: Cannot unset hooked property B::$prop
diff --git a/Zend/tests/property_hooks/override_add_get.phpt b/Zend/tests/property_hooks/override_add_get.phpt
index df2739e6086c..2848d38273d3 100644
--- a/Zend/tests/property_hooks/override_add_get.phpt
+++ b/Zend/tests/property_hooks/override_add_get.phpt
@@ -20,8 +20,8 @@ $a = new A;
$a->prop = 1;
try {
var_dump($a->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$b = new B;
@@ -31,7 +31,7 @@ var_dump($b->prop);
?>
--EXPECT--
A::A::$prop::set
-Cannot read from set-only virtual property A::$prop
+Error: Cannot read from set-only virtual property A::$prop
B::B::$prop::set
B::B::$prop::get
int(42)
diff --git a/Zend/tests/property_hooks/override_add_set.phpt b/Zend/tests/property_hooks/override_add_set.phpt
index e13de15f0b82..ba3c9c94127e 100644
--- a/Zend/tests/property_hooks/override_add_set.phpt
+++ b/Zend/tests/property_hooks/override_add_set.phpt
@@ -19,8 +19,8 @@ class B extends A {
$a = new A;
try {
$a->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($a->prop);
@@ -30,7 +30,7 @@ var_dump($b->prop);
?>
--EXPECT--
-Cannot write to get-only virtual property A::$prop
+Error: Cannot write to get-only virtual property A::$prop
A::A::$prop::get
int(42)
B::B::$prop::set
diff --git a/Zend/tests/property_hooks/parent_get_in_class_with_no_parent.phpt b/Zend/tests/property_hooks/parent_get_in_class_with_no_parent.phpt
index 767e585f9199..0519b652254e 100644
--- a/Zend/tests/property_hooks/parent_get_in_class_with_no_parent.phpt
+++ b/Zend/tests/property_hooks/parent_get_in_class_with_no_parent.phpt
@@ -12,10 +12,10 @@ class Foo {
$foo = new Foo();
try {
var_dump($foo->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot use "parent" when current class scope has no parent
+Error: Cannot use "parent" when current class scope has no parent
diff --git a/Zend/tests/property_hooks/parent_get_plain_typed_uninitialized.phpt b/Zend/tests/property_hooks/parent_get_plain_typed_uninitialized.phpt
index 0edd8ff074ef..0fc8fea23b48 100644
--- a/Zend/tests/property_hooks/parent_get_plain_typed_uninitialized.phpt
+++ b/Zend/tests/property_hooks/parent_get_plain_typed_uninitialized.phpt
@@ -16,10 +16,10 @@ class C extends P {
$c = new C();
try {
var_dump($c->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Typed property C::$prop must not be accessed before initialization
+Error: Typed property C::$prop must not be accessed before initialization
diff --git a/Zend/tests/property_hooks/parent_get_plain_zpp.phpt b/Zend/tests/property_hooks/parent_get_plain_zpp.phpt
index 04ac779f607b..0e96f3fa99e0 100644
--- a/Zend/tests/property_hooks/parent_get_plain_zpp.phpt
+++ b/Zend/tests/property_hooks/parent_get_plain_zpp.phpt
@@ -18,10 +18,10 @@ class B extends A {
$b = new B();
try {
var_dump($b->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-A::$prop::get() expects exactly 0 arguments, 1 given
+ArgumentCountError: A::$prop::get() expects exactly 0 arguments, 1 given
diff --git a/Zend/tests/property_hooks/parent_get_undefined_property.phpt b/Zend/tests/property_hooks/parent_get_undefined_property.phpt
index 388448963e3e..04967cbcf539 100644
--- a/Zend/tests/property_hooks/parent_get_undefined_property.phpt
+++ b/Zend/tests/property_hooks/parent_get_undefined_property.phpt
@@ -16,10 +16,10 @@ class C extends P {
$c = new C();
try {
var_dump($c->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Undefined property P::$prop
+Error: Undefined property P::$prop
diff --git a/Zend/tests/property_hooks/parent_set_plain_zpp.phpt b/Zend/tests/property_hooks/parent_set_plain_zpp.phpt
index aa95552af563..5a6984ae7e19 100644
--- a/Zend/tests/property_hooks/parent_set_plain_zpp.phpt
+++ b/Zend/tests/property_hooks/parent_set_plain_zpp.phpt
@@ -18,10 +18,10 @@ class B extends A {
$b = new B();
try {
$b->prop = 42;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-A::$prop::set() expects exactly 1 argument, 2 given
+ArgumentCountError: A::$prop::set() expects exactly 1 argument, 2 given
diff --git a/Zend/tests/property_hooks/parent_superfluous_args.phpt b/Zend/tests/property_hooks/parent_superfluous_args.phpt
index 2abcd7e7d10d..38658eac96fa 100644
--- a/Zend/tests/property_hooks/parent_superfluous_args.phpt
+++ b/Zend/tests/property_hooks/parent_superfluous_args.phpt
@@ -34,18 +34,18 @@ var_dump($b->virtual);
// Calling the implicit parent hook with extra args is not ok, since it is an internal function.
try {
var_dump($b->backed = 42);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($b->backed);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
int(42)
NULL
-A::$backed::set() expects exactly 1 argument, 2 given
-A::$backed::get() expects exactly 0 arguments, 1 given
+ArgumentCountError: A::$backed::set() expects exactly 1 argument, 2 given
+ArgumentCountError: A::$backed::get() expects exactly 0 arguments, 1 given
diff --git a/Zend/tests/property_hooks/parent_wrong_property_info.phpt b/Zend/tests/property_hooks/parent_wrong_property_info.phpt
index c18aad7f11f9..e01e2dd719d9 100644
--- a/Zend/tests/property_hooks/parent_wrong_property_info.phpt
+++ b/Zend/tests/property_hooks/parent_wrong_property_info.phpt
@@ -16,10 +16,10 @@ class B extends A {
$b = new B;
try {
var_dump($b->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot access private property A::$prop
+Error: Cannot access private property A::$prop
diff --git a/Zend/tests/property_hooks/read_sibling_backing_value.phpt b/Zend/tests/property_hooks/read_sibling_backing_value.phpt
index 65fe28fed32c..b8e1e5671f3c 100644
--- a/Zend/tests/property_hooks/read_sibling_backing_value.phpt
+++ b/Zend/tests/property_hooks/read_sibling_backing_value.phpt
@@ -25,10 +25,10 @@ $test = new Test;
try {
var_dump($test->a);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
+Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
diff --git a/Zend/tests/property_hooks/set.phpt b/Zend/tests/property_hooks/set.phpt
index 2928aee6cede..147f0b0e5d2c 100644
--- a/Zend/tests/property_hooks/set.phpt
+++ b/Zend/tests/property_hooks/set.phpt
@@ -16,17 +16,17 @@ var_dump($test->_prop);
try {
var_dump($test->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(isset($test->prop));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
int(42)
-Cannot read from set-only virtual property Test::$prop
-Cannot read from set-only virtual property Test::$prop
+Error: Cannot read from set-only virtual property Test::$prop
+Error: Cannot read from set-only virtual property Test::$prop
diff --git a/Zend/tests/property_hooks/unset.phpt b/Zend/tests/property_hooks/unset.phpt
index 49edd56831a0..d9b2b29fb3ce 100644
--- a/Zend/tests/property_hooks/unset.phpt
+++ b/Zend/tests/property_hooks/unset.phpt
@@ -18,12 +18,12 @@ $test = new Test;
$test->prop = 42;
try {
unset($test->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->prop);
?>
--EXPECT--
-Cannot unset hooked property Test::$prop
+Error: Cannot unset hooked property Test::$prop
int(42)
diff --git a/Zend/tests/property_hooks/virtual_read_write.phpt b/Zend/tests/property_hooks/virtual_read_write.phpt
index e5451ee1ceb5..61eeba0e4f8f 100644
--- a/Zend/tests/property_hooks/virtual_read_write.phpt
+++ b/Zend/tests/property_hooks/virtual_read_write.phpt
@@ -33,17 +33,17 @@ $test = new Test;
try {
$test->prop = 0;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump($test->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
-Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
+Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
+Error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
diff --git a/Zend/tests/readonly_classes/gh10377.phpt b/Zend/tests/readonly_classes/gh10377.phpt
index c9e902ae739d..faa4ae330bf7 100644
--- a/Zend/tests/readonly_classes/gh10377.phpt
+++ b/Zend/tests/readonly_classes/gh10377.phpt
@@ -20,23 +20,23 @@ $anon = new class {
var_dump($readonly_anon->field);
try {
$readonly_anon->field = 123;
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($readonly_anon->field);
var_dump($anon->field);
try {
$anon->field = 123;
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($anon->field);
?>
--EXPECT--
int(2)
-Cannot modify readonly property class@anonymous::$field
+Error: Cannot modify readonly property class@anonymous::$field
int(2)
int(2)
int(123)
diff --git a/Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt b/Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt
index b4da25ab0fec..6b3234a18fe3 100644
--- a/Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt
+++ b/Zend/tests/readonly_classes/readonly_class_dynamic_property.phpt
@@ -11,10 +11,10 @@ $foo = new Foo();
try {
$foo->bar = 1;
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot create dynamic property Foo::$bar
+Error: Cannot create dynamic property Foo::$bar
diff --git a/Zend/tests/readonly_classes/readonly_class_property1.phpt b/Zend/tests/readonly_classes/readonly_class_property1.phpt
index 34e09eecd7fc..acd9c3e68974 100644
--- a/Zend/tests/readonly_classes/readonly_class_property1.phpt
+++ b/Zend/tests/readonly_classes/readonly_class_property1.phpt
@@ -16,10 +16,10 @@ $foo = new Foo();
try {
$foo->bar = 2;
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$bar
diff --git a/Zend/tests/readonly_classes/readonly_class_property2.phpt b/Zend/tests/readonly_classes/readonly_class_property2.phpt
index 6db08f4dfb38..ad491185bd87 100644
--- a/Zend/tests/readonly_classes/readonly_class_property2.phpt
+++ b/Zend/tests/readonly_classes/readonly_class_property2.phpt
@@ -14,10 +14,10 @@ $foo = new Foo(1);
try {
$foo->bar = 2;
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$bar
diff --git a/Zend/tests/readonly_classes/readonly_class_unserialize_error.phpt b/Zend/tests/readonly_classes/readonly_class_unserialize_error.phpt
index e0672e4d97f8..c8ee17cb295c 100644
--- a/Zend/tests/readonly_classes/readonly_class_unserialize_error.phpt
+++ b/Zend/tests/readonly_classes/readonly_class_unserialize_error.phpt
@@ -7,10 +7,10 @@ readonly class C {}
try {
$readonly = unserialize('O:1:"C":1:{s:1:"x";b:1;}');
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot create dynamic property C::$x
+Error: Cannot create dynamic property C::$x
diff --git a/Zend/tests/readonly_props/array_append_initialization.phpt b/Zend/tests/readonly_props/array_append_initialization.phpt
index d9b3e8c07443..19008bf29f1c 100644
--- a/Zend/tests/readonly_props/array_append_initialization.phpt
+++ b/Zend/tests/readonly_props/array_append_initialization.phpt
@@ -21,17 +21,17 @@ function init() {
try {
(new C)->init();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
init();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot indirectly modify readonly property C::$a
-Cannot indirectly modify readonly property C::$a
+Error: Cannot indirectly modify readonly property C::$a
+Error: Cannot indirectly modify readonly property C::$a
diff --git a/Zend/tests/readonly_props/by_ref_foreach.phpt b/Zend/tests/readonly_props/by_ref_foreach.phpt
index dfc1d1709371..67e3d31fae8e 100644
--- a/Zend/tests/readonly_props/by_ref_foreach.phpt
+++ b/Zend/tests/readonly_props/by_ref_foreach.phpt
@@ -20,10 +20,10 @@ $test->init();
try {
foreach ($test as &$prop) {}
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot acquire reference to readonly property Test::$prop
+Error: Cannot acquire reference to readonly property Test::$prop
diff --git a/Zend/tests/readonly_props/cache_slot.phpt b/Zend/tests/readonly_props/cache_slot.phpt
index af7f73c36eb9..53d2bcef5873 100644
--- a/Zend/tests/readonly_props/cache_slot.phpt
+++ b/Zend/tests/readonly_props/cache_slot.phpt
@@ -29,8 +29,8 @@ $test->setProp("a");
var_dump($test->prop);
try {
$test->setProp("b");
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->prop);
echo "\n";
@@ -38,13 +38,13 @@ echo "\n";
$test = new Test;
try {
$test->initAndAppendProp2();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->initAndAppendProp2();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->prop2);
echo "\n";
@@ -65,13 +65,13 @@ $appendProp2 = (function() {
})->bindTo($test, Test::class);
try {
$appendProp2();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$appendProp2();
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($test->prop2);
echo "\n";
@@ -90,11 +90,11 @@ var_dump($test->prop3);
?>
--EXPECTF--
string(1) "a"
-Cannot modify readonly property Test::$prop
+Error: Cannot modify readonly property Test::$prop
string(1) "a"
-Cannot indirectly modify readonly property Test::$prop2
-Cannot modify readonly property Test::$prop2
+Error: Cannot indirectly modify readonly property Test::$prop2
+Error: Cannot modify readonly property Test::$prop2
array(0) {
}
@@ -107,8 +107,8 @@ object(stdClass)#%d (1) {
int(1)
}
-Cannot indirectly modify readonly property Test::$prop2
-Cannot indirectly modify readonly property Test::$prop2
+Error: Cannot indirectly modify readonly property Test::$prop2
+Error: Cannot indirectly modify readonly property Test::$prop2
array(0) {
}
diff --git a/Zend/tests/readonly_props/gh7942.phpt b/Zend/tests/readonly_props/gh7942.phpt
index 89db53439a2f..ff41043d771a 100644
--- a/Zend/tests/readonly_props/gh7942.phpt
+++ b/Zend/tests/readonly_props/gh7942.phpt
@@ -13,10 +13,10 @@ class Foo {
try {
$i = 42;
new Foo($i);
-} catch (Error $e) {
- echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot indirectly modify readonly property Foo::$bar
+Error: Cannot indirectly modify readonly property Foo::$bar
diff --git a/Zend/tests/readonly_props/initialization_scope.phpt b/Zend/tests/readonly_props/initialization_scope.phpt
index 49a4341e138f..c694d1b7ca1c 100644
--- a/Zend/tests/readonly_props/initialization_scope.phpt
+++ b/Zend/tests/readonly_props/initialization_scope.phpt
@@ -19,8 +19,8 @@ class B extends A {
$test = new B;
try {
$test->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$test->initProtected();
var_dump($test);
@@ -59,7 +59,7 @@ var_dump($test);
?>
--EXPECTF--
-Cannot modify protected(set) readonly property A::$prop from global scope
+Error: Cannot modify protected(set) readonly property A::$prop from global scope
object(B)#%d (1) {
["prop"]=>
int(2)
diff --git a/Zend/tests/readonly_props/magic_get_set.phpt b/Zend/tests/readonly_props/magic_get_set.phpt
index ff9d7c7e3325..f734c0c8817e 100644
--- a/Zend/tests/readonly_props/magic_get_set.phpt
+++ b/Zend/tests/readonly_props/magic_get_set.phpt
@@ -35,18 +35,18 @@ $test = new Test;
var_dump(isset($test->prop));
try {
var_dump($test->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$test->prop = 1;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
unset($test->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$test->unsetProp();
@@ -56,16 +56,16 @@ var_dump($test->prop);
$test->prop = 2;
try {
unset($test->prop);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
bool(false)
-Typed property Test::$prop must not be accessed before initialization
-Cannot modify protected(set) readonly property Test::$prop from global scope
-Cannot unset protected(set) readonly property Test::$prop from global scope
+Error: Typed property Test::$prop must not be accessed before initialization
+Error: Cannot modify protected(set) readonly property Test::$prop from global scope
+Error: Cannot unset protected(set) readonly property Test::$prop from global scope
Test::__isset(prop)
bool(true)
Test::__get(prop)
diff --git a/Zend/tests/readonly_props/promotion.phpt b/Zend/tests/readonly_props/promotion.phpt
index ee83246083b3..f7618b279d4d 100644
--- a/Zend/tests/readonly_props/promotion.phpt
+++ b/Zend/tests/readonly_props/promotion.phpt
@@ -15,8 +15,8 @@ var_dump(new Point);
$point = new Point(1.0, 2.0, 3.0);
try {
$point->x = 4.0;
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($point);
@@ -30,7 +30,7 @@ object(Point)#1 (3) {
["z"]=>
float(0)
}
-Cannot modify readonly property Point::$x
+Error: Cannot modify readonly property Point::$x
object(Point)#1 (3) {
["x"]=>
float(1)
diff --git a/Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt b/Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt
index 29218d837d7f..d39de17556a7 100644
--- a/Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt
+++ b/Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt
@@ -24,10 +24,10 @@ $foo = new Foo("");
try {
$foo->write();
-} catch (Error $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$bar
diff --git a/Zend/tests/readonly_props/readonly_clone_error1.phpt b/Zend/tests/readonly_props/readonly_clone_error1.phpt
index 98829d175765..39b150991f6a 100644
--- a/Zend/tests/readonly_props/readonly_clone_error1.phpt
+++ b/Zend/tests/readonly_props/readonly_clone_error1.phpt
@@ -20,8 +20,8 @@ $foo = new Foo(1);
try {
clone $foo;
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
echo "done";
@@ -32,5 +32,5 @@ object(Foo)#2 (1) {
["bar"]=>
int(2)
}
-Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$bar
done
diff --git a/Zend/tests/readonly_props/readonly_clone_error2.phpt b/Zend/tests/readonly_props/readonly_clone_error2.phpt
index e1e42abad074..d2a8f4017559 100644
--- a/Zend/tests/readonly_props/readonly_clone_error2.phpt
+++ b/Zend/tests/readonly_props/readonly_clone_error2.phpt
@@ -26,17 +26,17 @@ $foo = new Foo(1, 1);
try {
$foo->wrongCloneOld();
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
$foo->wrongCloneNew();
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot modify readonly property Foo::$bar
-Cannot modify readonly property Foo::$baz
+Error: Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$baz
diff --git a/Zend/tests/readonly_props/readonly_clone_error3.phpt b/Zend/tests/readonly_props/readonly_clone_error3.phpt
index a51ec165c68c..e436cd18a047 100644
--- a/Zend/tests/readonly_props/readonly_clone_error3.phpt
+++ b/Zend/tests/readonly_props/readonly_clone_error3.phpt
@@ -28,17 +28,17 @@ $foo = new Foo(1, 1);
try {
$foo->wrongCloneOld();
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
$foo->wrongCloneNew();
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot modify readonly property Foo::$bar
-Cannot modify readonly property Foo::$baz
+Error: Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$baz
diff --git a/Zend/tests/readonly_props/readonly_clone_error4.phpt b/Zend/tests/readonly_props/readonly_clone_error4.phpt
index f9edcbcbaa18..7596a78e3487 100644
--- a/Zend/tests/readonly_props/readonly_clone_error4.phpt
+++ b/Zend/tests/readonly_props/readonly_clone_error4.phpt
@@ -20,14 +20,14 @@ $foo = new Foo(1);
try {
clone $foo;
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
clone $foo;
-} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
@@ -36,9 +36,9 @@ object(Foo)#2 (1) {
["bar"]=>
int(3)
}
-Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$bar
object(Foo)#2 (1) {
["bar"]=>
int(3)
}
-Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$bar
diff --git a/Zend/tests/readonly_props/readonly_clone_error5.phpt b/Zend/tests/readonly_props/readonly_clone_error5.phpt
index a6a10fb8a27c..b795a1cc9aae 100644
--- a/Zend/tests/readonly_props/readonly_clone_error5.phpt
+++ b/Zend/tests/readonly_props/readonly_clone_error5.phpt
@@ -34,31 +34,31 @@ class TestSetTwice {
try {
var_dump(clone (new TestSetOnce()));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(clone (new TestSetOnce()));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(clone (new TestSetTwice()));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(clone (new TestSetTwice()));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot indirectly modify readonly property TestSetOnce::$prop
-Cannot indirectly modify readonly property TestSetOnce::$prop
-Cannot indirectly modify readonly property TestSetTwice::$prop
-Cannot indirectly modify readonly property TestSetTwice::$prop
+Error: Cannot indirectly modify readonly property TestSetOnce::$prop
+Error: Cannot indirectly modify readonly property TestSetOnce::$prop
+Error: Cannot indirectly modify readonly property TestSetTwice::$prop
+Error: Cannot indirectly modify readonly property TestSetTwice::$prop