Commit d88731692f1 for php.net

commit d88731692f1f9c7b0785a8f1aeae99a5a647bbbf
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date:   Sat Aug 22 20:22:45 2026 +0700

    Zend: applied fixers to improve test robustness (part 6/8) (#23314)

diff --git a/Zend/tests/readonly_props/readonly_clone_error6.phpt b/Zend/tests/readonly_props/readonly_clone_error6.phpt
index 16a04d802a1..f4ed5db4bb2 100644
--- a/Zend/tests/readonly_props/readonly_clone_error6.phpt
+++ b/Zend/tests/readonly_props/readonly_clone_error6.phpt
@@ -21,14 +21,14 @@ public function __clone()

 try {
     $foo->__clone();
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $foo->__clone();
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump($foo);
@@ -39,8 +39,8 @@ public function __clone()
   ["bar"]=>
   int(0)
 }
-Cannot modify readonly property Foo::$bar
-Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$bar
 object(Foo)#%d (%d) {
   ["bar"]=>
   int(0)
diff --git a/Zend/tests/readonly_props/readonly_clone_error7.phpt b/Zend/tests/readonly_props/readonly_clone_error7.phpt
index e34ad9eb3d7..6925daf86fd 100644
--- a/Zend/tests/readonly_props/readonly_clone_error7.phpt
+++ b/Zend/tests/readonly_props/readonly_clone_error7.phpt
@@ -18,16 +18,16 @@ public function __clone()
 // First call fills the cache slot
 try {
     var_dump(clone $foo);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(clone $foo);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Cannot indirectly modify readonly property Foo::$bar
-Cannot indirectly modify readonly property Foo::$bar
+Error: Cannot indirectly modify readonly property Foo::$bar
+Error: Cannot indirectly modify readonly property Foo::$bar
diff --git a/Zend/tests/readonly_props/readonly_clone_success4.phpt b/Zend/tests/readonly_props/readonly_clone_success4.phpt
index 40b7a29e312..ab13e88a5c3 100644
--- a/Zend/tests/readonly_props/readonly_clone_success4.phpt
+++ b/Zend/tests/readonly_props/readonly_clone_success4.phpt
@@ -12,8 +12,8 @@ public function __clone()
     {
         try {
             $this->bar = "foo";
-        } catch (Error $e) {
-            echo $e->getMessage() . "\n";
+        } catch (Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }

         $this->bar = 2;
@@ -27,12 +27,12 @@ public function __clone()

 ?>
 --EXPECTF--
-Cannot assign string to property Foo::$bar of type int
+TypeError: Cannot assign string to property Foo::$bar of type int
 object(Foo)#%d (%d) {
   ["bar"]=>
   int(2)
 }
-Cannot assign string to property Foo::$bar of type int
+TypeError: Cannot assign string to property Foo::$bar of type int
 object(Foo)#%d (%d) {
   ["bar"]=>
   int(2)
diff --git a/Zend/tests/readonly_props/readonly_coercion_type_error.phpt b/Zend/tests/readonly_props/readonly_coercion_type_error.phpt
index d41211d8e99..36ad807f242 100644
--- a/Zend/tests/readonly_props/readonly_coercion_type_error.phpt
+++ b/Zend/tests/readonly_props/readonly_coercion_type_error.phpt
@@ -10,8 +10,8 @@ public function __construct() {
         $this->bar = 'bar';
         try {
             $this->bar = 42;
-        } catch (Error $e) {
-            echo $e->getMessage(), "\n";
+        } catch (Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
 }
@@ -20,4 +20,4 @@ public function __construct() {

 ?>
 --EXPECTF--
-Cannot modify readonly property Foo::$bar
+Error: Cannot modify readonly property Foo::$bar
diff --git a/Zend/tests/readonly_props/readonly_containing_object.phpt b/Zend/tests/readonly_props/readonly_containing_object.phpt
index 996b0ee3d44..bf6a88c8b30 100644
--- a/Zend/tests/readonly_props/readonly_containing_object.phpt
+++ b/Zend/tests/readonly_props/readonly_containing_object.phpt
@@ -17,18 +17,18 @@ public function __construct(object $prop) {
 $test->prop->foo++;
 try {
     $test->prop += 1;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->prop++;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     --$test->prop;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($test->prop);

@@ -44,9 +44,9 @@ public function __construct(object $prop) {

 ?>
 --EXPECT--
-Unsupported operand types: stdClass + int
-Cannot modify readonly property Test::$prop
-Cannot modify readonly property Test::$prop
+TypeError: Unsupported operand types: stdClass + int
+Error: Cannot modify readonly property Test::$prop
+Error: Cannot modify readonly property Test::$prop
 object(stdClass)#2 (1) {
   ["foo"]=>
   int(3)
diff --git a/Zend/tests/readonly_props/readonly_modification.phpt b/Zend/tests/readonly_props/readonly_modification.phpt
index bd04a203be1..d251e5c37c9 100644
--- a/Zend/tests/readonly_props/readonly_modification.phpt
+++ b/Zend/tests/readonly_props/readonly_modification.phpt
@@ -20,63 +20,63 @@ function byRef(&$ref) {}
 var_dump($test->prop); // Read.
 try {
     $test->prop = 2;
-} 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 {
     $test->prop++;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     ++$test->prop;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $ref =& $test->prop;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->prop =& $ref;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     byRef($test->prop);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump($test->prop2); // Read.
 try {
     $test->prop2[] = 1;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->prop2[0][] = 1;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
 int(1)
-Cannot modify readonly property Test::$prop
-Cannot modify readonly property Test::$prop
-Cannot modify readonly property Test::$prop
-Cannot modify readonly property Test::$prop
-Cannot indirectly modify readonly property Test::$prop
-Cannot indirectly modify readonly property Test::$prop
-Cannot indirectly modify readonly property Test::$prop
+Error: Cannot modify readonly property Test::$prop
+Error: Cannot modify readonly property Test::$prop
+Error: Cannot modify readonly property Test::$prop
+Error: Cannot modify readonly property Test::$prop
+Error: Cannot indirectly modify readonly property Test::$prop
+Error: Cannot indirectly modify readonly property Test::$prop
+Error: Cannot indirectly modify readonly property Test::$prop
 array(0) {
 }
-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
diff --git a/Zend/tests/readonly_props/unset.phpt b/Zend/tests/readonly_props/unset.phpt
index 823c021f612..7d6db9fc5ab 100644
--- a/Zend/tests/readonly_props/unset.phpt
+++ b/Zend/tests/readonly_props/unset.phpt
@@ -14,8 +14,8 @@ public function __construct(int $prop) {
 $test = new Test(1);
 try {
     unset($test->prop);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 class Test2 {
@@ -39,8 +39,8 @@ public function __get($name) {
 var_dump($test->prop); // Don't call __get.
 try {
     unset($test->prop); // Unset initialized, illegal.
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 class Test3 {
@@ -50,8 +50,8 @@ class Test3 {
 $test = new Test3;
 try {
     unset($test->prop);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 class Test4 {
@@ -60,8 +60,8 @@ class Test4 {
     public function __construct() {
         try {
             unset($this->prop);
-        } catch (Error $e) {
-            echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+        } catch (Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }

@@ -74,19 +74,19 @@ public function __get($name) {
 var_dump($test->prop); // Don't call __get.
 try {
     unset($test->prop);
-} catch (Error $e) {
-    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($test->prop); // Still don't call __get.

 ?>
 --EXPECT--
-Cannot unset readonly property Test::$prop
+Error: Cannot unset readonly property Test::$prop
 Test2::__get
 int(1)
 int(1)
-Cannot unset readonly property Test2::$prop
-Cannot unset protected(set) readonly property Test3::$prop from global scope
+Error: Cannot unset readonly property Test2::$prop
+Error: Cannot unset protected(set) readonly property Test3::$prop from global scope
 Error: Cannot unset readonly property Test4::$prop
 int(1)
 Error: Cannot unset readonly property Test4::$prop
diff --git a/Zend/tests/readonly_props/visibility_change.phpt b/Zend/tests/readonly_props/visibility_change.phpt
index f4a32f3cdaa..6e06efd61e6 100644
--- a/Zend/tests/readonly_props/visibility_change.phpt
+++ b/Zend/tests/readonly_props/visibility_change.phpt
@@ -17,8 +17,8 @@ class B extends A {
 $a = new A();
 try {
     var_dump($a->prop);
-} catch (Error $error) {
-    echo $error->getMessage() . "\n";
+} catch (Throwable $error) {
+    echo $error::class, ': ', $error->getMessage(), "\n";
 }

 $b = new B();
@@ -26,5 +26,5 @@ class B extends A {

 ?>
 --EXPECT--
-Cannot access protected property A::$prop
+Error: Cannot access protected property A::$prop
 int(42)
diff --git a/Zend/tests/recursive_array_comparison.phpt b/Zend/tests/recursive_array_comparison.phpt
index 53cc9736030..c136f400ae3 100644
--- a/Zend/tests/recursive_array_comparison.phpt
+++ b/Zend/tests/recursive_array_comparison.phpt
@@ -5,17 +5,17 @@
 $a = [&$a];
 try {
     $a === [[]];
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     [[]] === $a;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($a === $a);
 ?>
 --EXPECT--
-Nesting level too deep - recursive dependency?
-Nesting level too deep - recursive dependency?
+Error: Nesting level too deep - recursive dependency?
+Error: Nesting level too deep - recursive dependency?
 bool(true)
diff --git a/Zend/tests/recv_init_ref_type.phpt b/Zend/tests/recv_init_ref_type.phpt
index 29b96d379f8..3a72d265305 100644
--- a/Zend/tests/recv_init_ref_type.phpt
+++ b/Zend/tests/recv_init_ref_type.phpt
@@ -9,10 +9,10 @@ function test(array &$foo = []) {
 try {
     $bar = 42;
     test($bar);
-} catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-test(): Argument #1 ($foo) must be of type array, int given, called in %s on line %d
+TypeError: test(): Argument #1 ($foo) must be of type array, int given, called in %s on line %d
diff --git a/Zend/tests/require_once_warning_to_exception.phpt b/Zend/tests/require_once_warning_to_exception.phpt
index bc706622438..2eb33e035cd 100644
--- a/Zend/tests/require_once_warning_to_exception.phpt
+++ b/Zend/tests/require_once_warning_to_exception.phpt
@@ -10,10 +10,10 @@ function exception_error_handler($errno, $errstr, $errfile, $errline ) {

 try {
     $results = require_once 'does-not-exist.php';
-} catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 };

 ?>
 --EXPECT--
-require_once(): Failed to open stream: No such file or directory
+Exception: require_once(): Failed to open stream: No such file or directory
diff --git a/Zend/tests/require_parse_exception.phpt b/Zend/tests/require_parse_exception.phpt
index d64efe17867..331786bcaa1 100644
--- a/Zend/tests/require_parse_exception.phpt
+++ b/Zend/tests/require_parse_exception.phpt
@@ -8,8 +8,8 @@
 function test_parse_error($code) {
     try {
         require 'data://text/plain;base64,' . base64_encode($code);
-    } catch (ParseError $e) {
-        echo $e->getMessage(), " on line ", $e->getLine(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), ' on line ', $e->getLine(), "\n";
     }
 }

@@ -43,9 +43,9 @@ function f() {
 ?>
 --EXPECT--
 Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
-Unclosed '{' on line 2
-Unclosed '{' on line 3
-syntax error, unexpected end of file, expecting "(" on line 2
-Invalid numeric literal on line 2
-Invalid UTF-8 codepoint escape sequence on line 2
-Invalid UTF-8 codepoint escape sequence: Codepoint too large on line 2
+ParseError: Unclosed '{' on line 2
+ParseError: Unclosed '{' on line 3
+ParseError: syntax error, unexpected end of file, expecting "(" on line 2
+ParseError: Invalid numeric literal on line 2
+ParseError: Invalid UTF-8 codepoint escape sequence on line 2
+ParseError: Invalid UTF-8 codepoint escape sequence: Codepoint too large on line 2
diff --git a/Zend/tests/required_param_after_optional_named_args.phpt b/Zend/tests/required_param_after_optional_named_args.phpt
index 19060ab108b..c96d51ff008 100644
--- a/Zend/tests/required_param_after_optional_named_args.phpt
+++ b/Zend/tests/required_param_after_optional_named_args.phpt
@@ -7,11 +7,11 @@ function test($a = 1, $b) {
 }
 try {
     test(b: 2);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
 Deprecated: test(): Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
-test(): Argument #1 ($a) not passed
+ArgumentCountError: test(): Argument #1 ($a) not passed
diff --git a/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt b/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt
index afb099b6812..afa8a0e75bb 100644
--- a/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt
+++ b/Zend/tests/restrict_globals/invalid_pass_by_ref.phpt
@@ -6,18 +6,18 @@
 function by_ref(&$ref) {}
 try {
     by_ref($GLOBALS);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     by_ref2($GLOBALS);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 function by_ref2(&$ref) {}

 ?>
 --EXPECT--
-by_ref(): Argument #1 ($ref) could not be passed by reference
-by_ref2(): Argument #1 ($ref) could not be passed by reference
+Error: by_ref(): Argument #1 ($ref) could not be passed by reference
+Error: by_ref2(): Argument #1 ($ref) could not be passed by reference
diff --git a/Zend/tests/return_types/028.phpt b/Zend/tests/return_types/028.phpt
index 802dd7708df..efc356e1d10 100644
--- a/Zend/tests/return_types/028.phpt
+++ b/Zend/tests/return_types/028.phpt
@@ -11,10 +11,10 @@ function foo(): stdClass {

 try {
     foo();
-} catch (Error $e) {
-    echo $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine();
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), ' in ', $e->getFile(), ' on line ', $e->getLine(), "\n";
 }

 ?>
 --EXPECTF--
-foo(): Return value must be of type stdClass, array returned in %s on line %d
+TypeError: foo(): Return value must be of type stdClass, array returned in %s on line %d
diff --git a/Zend/tests/return_types/bug70557.phpt b/Zend/tests/return_types/bug70557.phpt
index 1795a2a26a7..f804678f83d 100644
--- a/Zend/tests/return_types/bug70557.phpt
+++ b/Zend/tests/return_types/bug70557.phpt
@@ -9,9 +9,9 @@ function getNumber() : int {

 try {
     getNumber();
-} catch (TypeError $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-string(62) "getNumber(): Return value must be of type int, string returned"
+TypeError: getNumber(): Return value must be of type int, string returned
diff --git a/Zend/tests/return_types/never_disallowed5.phpt b/Zend/tests/return_types/never_disallowed5.phpt
index 26887cd4683..c6ca9a5def0 100644
--- a/Zend/tests/return_types/never_disallowed5.phpt
+++ b/Zend/tests/return_types/never_disallowed5.phpt
@@ -13,9 +13,9 @@ public static function bar(): never {

 try {
     Foo::bar();
-} catch (TypeError $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Foo::bar(): never-returning method must not implicitly return
+TypeError: Foo::bar(): never-returning method must not implicitly return
diff --git a/Zend/tests/self_and.phpt b/Zend/tests/self_and.phpt
index f3662c575c4..76b370a3578 100644
--- a/Zend/tests/self_and.phpt
+++ b/Zend/tests/self_and.phpt
@@ -15,8 +15,8 @@
 try {
     $s1 &= 11;
     var_dump($s1);
-} catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $s2 &= 33;
@@ -32,7 +32,7 @@
 ?>
 --EXPECTF--
 int(18)
-Unsupported operand types: string & int
+TypeError: Unsupported operand types: string & int

 Warning: A non-numeric value encountered in %s on line %d
 int(33)
diff --git a/Zend/tests/self_instanceof_outside_class.phpt b/Zend/tests/self_instanceof_outside_class.phpt
index ecb593a6a58..ffee9a84675 100644
--- a/Zend/tests/self_instanceof_outside_class.phpt
+++ b/Zend/tests/self_instanceof_outside_class.phpt
@@ -6,12 +6,12 @@
 $fn = function() {
     try {
         new stdClass instanceof self;
-    } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 };
 $fn();

 ?>
 --EXPECT--
-Cannot access "self" when no class scope is active
+Error: Cannot access "self" when no class scope is active
diff --git a/Zend/tests/self_method_or_prop_outside_class.phpt b/Zend/tests/self_method_or_prop_outside_class.phpt
index feaeccf25f9..c534dcf62af 100644
--- a/Zend/tests/self_method_or_prop_outside_class.phpt
+++ b/Zend/tests/self_method_or_prop_outside_class.phpt
@@ -7,30 +7,30 @@
     $str = "foo";
     try {
         self::${$str . "bar"};
-    } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     try {
         unset(self::${$str . "bar"});
-    } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     try {
         isset(self::${$str . "bar"});
-    } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     try {
         self::{$str . "bar"}();
-    } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 };
 $fn();

 ?>
 --EXPECT--
-Cannot access "self" when no class scope is active
-Cannot access "self" when no class scope is active
-Cannot access "self" when no class scope is active
-Cannot access "self" when no class scope is active
+Error: Cannot access "self" when no class scope is active
+Error: Cannot access "self" when no class scope is active
+Error: Cannot access "self" when no class scope is active
+Error: Cannot access "self" when no class scope is active
diff --git a/Zend/tests/self_mod.phpt b/Zend/tests/self_mod.phpt
index 7d469f80023..feaa3451777 100644
--- a/Zend/tests/self_mod.phpt
+++ b/Zend/tests/self_mod.phpt
@@ -13,8 +13,8 @@
 try {
     $s1 %= 11;
     var_dump($s1);
-} catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $s2 %= 33;
@@ -24,7 +24,7 @@
 ?>
 --EXPECTF--
 int(13)
-Unsupported operand types: string % int
+TypeError: Unsupported operand types: string % int

 Warning: A non-numeric value encountered in %s on line %d
 int(3)
diff --git a/Zend/tests/self_or.phpt b/Zend/tests/self_or.phpt
index 61f1f4203b0..5ad5d8dbaee 100644
--- a/Zend/tests/self_or.phpt
+++ b/Zend/tests/self_or.phpt
@@ -15,8 +15,8 @@
 try {
     $s1 |= 11;
     var_dump($s1);
-} catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $s2 |= 33;
@@ -32,7 +32,7 @@
 ?>
 --EXPECTF--
 int(127)
-Unsupported operand types: string | int
+TypeError: Unsupported operand types: string | int

 Warning: A non-numeric value encountered in %s on line %d
 int(45345)
diff --git a/Zend/tests/self_xor.phpt b/Zend/tests/self_xor.phpt
index 4bff3f6d508..8262d185f7e 100644
--- a/Zend/tests/self_xor.phpt
+++ b/Zend/tests/self_xor.phpt
@@ -15,8 +15,8 @@
 try {
     $s1 ^= 11;
     var_dump($s1);
-} catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $s2 ^= 33;
@@ -32,7 +32,7 @@
 ?>
 --EXPECTF--
 int(109)
-Unsupported operand types: string ^ int
+TypeError: Unsupported operand types: string ^ int

 Warning: A non-numeric value encountered in %s on line %d
 int(45312)
diff --git a/Zend/tests/serialize/bug64354.phpt b/Zend/tests/serialize/bug64354.phpt
index 11b0aa31e24..fde6dd5cc01 100644
--- a/Zend/tests/serialize/bug64354.phpt
+++ b/Zend/tests/serialize/bug64354.phpt
@@ -16,10 +16,10 @@ public function unserialize($data) {

 try {
     serialize($data);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
 Deprecated: B implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
-string(9) "serialize"
+Exception: serialize
diff --git a/Zend/tests/serialize/bug71841.phpt b/Zend/tests/serialize/bug71841.phpt
index f32b0e9b231..75b1269eb9f 100644
--- a/Zend/tests/serialize/bug71841.phpt
+++ b/Zend/tests/serialize/bug71841.phpt
@@ -5,41 +5,41 @@
 $z = unserialize('O:1:"A":0:{}');
 try {
     var_dump($z->e.=0);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(++$z->x);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($z->y++);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $y = array(PHP_INT_MAX => 0);
 try {
     var_dump($y[] .= 0);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(++$y[]);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($y[]++);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
-The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
-The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
-Cannot add element to the array as the next element is already occupied
-Cannot add element to the array as the next element is already occupied
-Cannot add element to the array as the next element is already occupied
+Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
+Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
+Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
+Error: Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
+Error: Cannot add element to the array as the next element is already occupied
diff --git a/Zend/tests/shift_001.phpt b/Zend/tests/shift_001.phpt
index f441cf2dcf8..e66bb5306a3 100644
--- a/Zend/tests/shift_001.phpt
+++ b/Zend/tests/shift_001.phpt
@@ -13,8 +13,8 @@
 try {
     $s1 <<= 1;
     var_dump($s1);
-} catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $s2 <<= 3;
@@ -24,7 +24,7 @@
 ?>
 --EXPECTF--
 int(492)
-Unsupported operand types: string << int
+TypeError: Unsupported operand types: string << int

 Warning: A non-numeric value encountered in %s on line %d
 int(362760)
diff --git a/Zend/tests/shift_002.phpt b/Zend/tests/shift_002.phpt
index 0bdc9b3eeb3..3434c9332e6 100644
--- a/Zend/tests/shift_002.phpt
+++ b/Zend/tests/shift_002.phpt
@@ -13,8 +13,8 @@
 try {
     $s1 >>= 1;
     var_dump($s1);
-} catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $s2 >>= 3;
@@ -24,7 +24,7 @@
 ?>
 --EXPECTF--
 int(30)
-Unsupported operand types: string >> int
+TypeError: Unsupported operand types: string >> int

 Warning: A non-numeric value encountered in %s on line %d
 int(5668)
diff --git a/Zend/tests/stack_limit/stack_limit_001.phpt b/Zend/tests/stack_limit/stack_limit_001.phpt
index 73cc3c08fe9..2142364de4f 100644
--- a/Zend/tests/stack_limit/stack_limit_001.phpt
+++ b/Zend/tests/stack_limit/stack_limit_001.phpt
@@ -35,20 +35,20 @@ function replace() {

 try {
     new Test1;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     clone new Test2;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     replace();
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -63,6 +63,6 @@ function replace() {
   ["EG(stack_limit)"]=>
   string(%d) "0x%x"
 }
-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?
-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?
+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/stack_limit/stack_limit_002.phpt b/Zend/tests/stack_limit/stack_limit_002.phpt
index 64a11e1b263..059eecb9c4f 100644
--- a/Zend/tests/stack_limit/stack_limit_002.phpt
+++ b/Zend/tests/stack_limit/stack_limit_002.phpt
@@ -34,20 +34,20 @@ function replace() {
 $fiber = new Fiber(function (): void {
     try {
         new Test1;
-    } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }

     try {
         clone new Test2;
-    } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }

     try {
         replace();
-    } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 });

@@ -65,6 +65,6 @@ function replace() {
   ["EG(stack_limit)"]=>
   string(%d) "0x%x"
 }
-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?
-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?
+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/stack_limit/stack_limit_003.phpt b/Zend/tests/stack_limit/stack_limit_003.phpt
index 9956c761cb1..1d0d7c08964 100644
--- a/Zend/tests/stack_limit/stack_limit_003.phpt
+++ b/Zend/tests/stack_limit/stack_limit_003.phpt
@@ -33,20 +33,20 @@ function replace() {

 try {
     new Test1;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     clone new Test2;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     replace();
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -61,6 +61,6 @@ function replace() {
   ["EG(stack_limit)"]=>
   string(%d) "0x%x"
 }
-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?
-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?
+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/stack_limit/stack_limit_006.phpt b/Zend/tests/stack_limit/stack_limit_006.phpt
index d8d6251cf0c..4e187a513a3 100644
--- a/Zend/tests/stack_limit/stack_limit_006.phpt
+++ b/Zend/tests/stack_limit/stack_limit_006.phpt
@@ -292,20 +292,20 @@ function replace() {

 try {
     new Test1;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     clone new Test2;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     replace();
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -320,6 +320,6 @@ function replace() {
   ["EG(stack_limit)"]=>
   string(%d) "0x%x"
 }
-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?
-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?
+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/stack_limit/stack_limit_007.phpt b/Zend/tests/stack_limit/stack_limit_007.phpt
index d34e244234c..58478cc5a1c 100644
--- a/Zend/tests/stack_limit/stack_limit_007.phpt
+++ b/Zend/tests/stack_limit/stack_limit_007.phpt
@@ -18,8 +18,8 @@ function replace() {
         try {
             $tryExecuted = true;
             return replace();
-        } catch (Error $e) {
-            echo $e->getMessage(), "\n";
+        } catch (Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
             // We should not enter the catch block if we haven't executed at
             // least one op in the try block
             printf("Try executed: %d\n", $tryExecuted ?? 0);
@@ -41,5 +41,5 @@ function replace() {
   ["EG(stack_limit)"]=>
   string(%d) "0x%x"
 }
-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?
 Try executed: 1
diff --git a/Zend/tests/stack_limit/stack_limit_008.phpt b/Zend/tests/stack_limit/stack_limit_008.phpt
index db61fb15e52..e52f2f350ad 100644
--- a/Zend/tests/stack_limit/stack_limit_008.phpt
+++ b/Zend/tests/stack_limit/stack_limit_008.phpt
@@ -21,8 +21,8 @@ function replace() {
             echo "Will throw:\n";
             try {
                 return replace2();
-            } catch (Error $e) {
-                echo $e->getMessage();
+            } catch (Throwable $e) {
+                echo $e::class, ': ', $e->getMessage(), "\n";
             }
         }
     }, 'x');
@@ -55,4 +55,4 @@ function replace2() {
   string(%d) "0x%x"
 }
 Will throw:
-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/stack_limit/stack_limit_011.phpt b/Zend/tests/stack_limit/stack_limit_011.phpt
index 762f67184f6..15aa89d78c6 100644
--- a/Zend/tests/stack_limit/stack_limit_011.phpt
+++ b/Zend/tests/stack_limit/stack_limit_011.phpt
@@ -34,8 +34,8 @@ function replace() {

 try {
     replace();
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
     echo 'Previous: ', $e->getPrevious()->getMessage(), "\n";
 }

@@ -51,5 +51,5 @@ function replace() {
   ["EG(stack_limit)"]=>
   string(%d) "0x%x"
 }
-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?
 Previous: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
diff --git a/Zend/tests/stack_limit/stack_limit_014.phpt b/Zend/tests/stack_limit/stack_limit_014.phpt
index 144c64ad39e..d9e87f4de79 100644
--- a/Zend/tests/stack_limit/stack_limit_014.phpt
+++ b/Zend/tests/stack_limit/stack_limit_014.phpt
@@ -15,8 +15,8 @@

 try {
     require __DIR__.'/stack_limit_014.inc';
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
diff --git a/Zend/tests/static_method_non_existing_class.phpt b/Zend/tests/static_method_non_existing_class.phpt
index 752655d2278..6917a4de3e9 100644
--- a/Zend/tests/static_method_non_existing_class.phpt
+++ b/Zend/tests/static_method_non_existing_class.phpt
@@ -6,10 +6,10 @@
 $str = "foo";
 try {
     Test::{$str . "bar"}();
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Class "Test" not found
+Error: Class "Test" not found
diff --git a/Zend/tests/static_variables/static_variables_destructor.phpt b/Zend/tests/static_variables/static_variables_destructor.phpt
index 9128c86e6b1..8377db2f74c 100644
--- a/Zend/tests/static_variables/static_variables_destructor.phpt
+++ b/Zend/tests/static_variables/static_variables_destructor.phpt
@@ -24,13 +24,13 @@ function foo(bool $throw) {

 try {
     foo(true);
-} catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 foo(false);

 ?>
 --EXPECT--
 bar() called
-__destruct() called
+Exception: __destruct() called
 int(42)
diff --git a/Zend/tests/static_variables/static_variables_throwing_initializer.phpt b/Zend/tests/static_variables/static_variables_throwing_initializer.phpt
index 9e4752c24f5..c5b5a1223c7 100644
--- a/Zend/tests/static_variables/static_variables_throwing_initializer.phpt
+++ b/Zend/tests/static_variables/static_variables_throwing_initializer.phpt
@@ -10,12 +10,12 @@ function foo($throw) {

 try {
     var_dump(foo(true));
-} catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump(foo(false));

 ?>
 --EXPECT--
-Throwing from foo()
+Exception: Throwing from foo()
 int(42)
diff --git a/Zend/tests/string_offset_as_object.phpt b/Zend/tests/string_offset_as_object.phpt
index 6fdebe93608..f5d477ef1b3 100644
--- a/Zend/tests/string_offset_as_object.phpt
+++ b/Zend/tests/string_offset_as_object.phpt
@@ -6,58 +6,58 @@
 $str = "x";
 try {
     $str[0]->bar = "xyz";
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $str[0]->bar[1] = "bang";
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $str[0]->bar += 1;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $str[0]->bar = &$b;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     ++$str[0]->bar;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     --$str[0]->bar;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $str[0]->bar++;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $str[0]->bar--;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     unset($str[0]->bar);
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Cannot use string offset as an object
-Cannot use string offset as an object
-Cannot use string offset as an object
-Cannot use string offset as an object
-Cannot use string offset as an object
-Cannot use string offset as an object
-Cannot use string offset as an object
-Cannot use string offset as an object
-Cannot use string offset as an object
+Error: Cannot use string offset as an object
+Error: Cannot use string offset as an object
+Error: Cannot use string offset as an object
+Error: Cannot use string offset as an object
+Error: Cannot use string offset as an object
+Error: Cannot use string offset as an object
+Error: Cannot use string offset as an object
+Error: Cannot use string offset as an object
+Error: Cannot use string offset as an object
diff --git a/Zend/tests/string_offset_errors.phpt b/Zend/tests/string_offset_errors.phpt
index 726dc41f065..60c5399f5a6 100644
--- a/Zend/tests/string_offset_errors.phpt
+++ b/Zend/tests/string_offset_errors.phpt
@@ -15,25 +15,25 @@ function &gen() {

 try {
     test();
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $str = "foo";
     $str[0] =& $str[1];
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     foreach (gen() as $v) {}
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Cannot create references to/from string offsets
-Cannot create references to/from string offsets
-Cannot create references to/from string offsets
+Error: Cannot create references to/from string offsets
+Error: Cannot create references to/from string offsets
+Error: Cannot create references to/from string offsets
diff --git a/Zend/tests/strlen_deprecation_to_exception.phpt b/Zend/tests/strlen_deprecation_to_exception.phpt
index 7b616f3b643..e7622db355b 100644
--- a/Zend/tests/strlen_deprecation_to_exception.phpt
+++ b/Zend/tests/strlen_deprecation_to_exception.phpt
@@ -8,10 +8,10 @@
 });
 try {
     strlen(null);
-} catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-strlen(): Passing null to parameter #1 ($string) of type string is deprecated
+Exception: strlen(): Passing null to parameter #1 ($string) of type string is deprecated
diff --git a/Zend/tests/strncasecmp_basic.phpt b/Zend/tests/strncasecmp_basic.phpt
index 54eb6fb5209..fc150741ada 100644
--- a/Zend/tests/strncasecmp_basic.phpt
+++ b/Zend/tests/strncasecmp_basic.phpt
@@ -5,8 +5,8 @@

 try {
     var_dump(strncasecmp("", "", -1));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(strncasecmp("aef", "dfsgbdf", 0));
@@ -19,7 +19,7 @@

 ?>
 --EXPECT--
-strncasecmp(): Argument #3 ($length) must be greater than or equal to 0
+ValueError: strncasecmp(): Argument #3 ($length) must be greater than or equal to 0
 int(0)
 int(-3)
 int(0)
diff --git a/Zend/tests/strncmp_basic.phpt b/Zend/tests/strncmp_basic.phpt
index bb40946f240..6f93ed23f93 100644
--- a/Zend/tests/strncmp_basic.phpt
+++ b/Zend/tests/strncmp_basic.phpt
@@ -6,8 +6,8 @@
 var_dump(strncmp("", "", 100));
 try {
     var_dump(strncmp("aef", "dfsgbdf", -1));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump(strncmp("fghjkl", "qwer", 0));
 var_dump(strncmp("qwerty", "qwerty123", 6));
@@ -16,7 +16,7 @@
 ?>
 --EXPECT--
 int(0)
-strncmp(): Argument #3 ($length) must be greater than or equal to 0
+ValueError: strncmp(): Argument #3 ($length) must be greater than or equal to 0
 int(0)
 int(0)
 int(-1)
diff --git a/Zend/tests/sub_001.phpt b/Zend/tests/sub_001.phpt
index 92e3ff0021f..bf134a7f236 100644
--- a/Zend/tests/sub_001.phpt
+++ b/Zend/tests/sub_001.phpt
@@ -8,8 +8,8 @@

 try {
     var_dump($a - $b);
-} catch (Error $e) {
-    echo "\nException: " . $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $c = $a - $b;
@@ -18,7 +18,7 @@
 echo "Done\n";
 ?>
 --EXPECTF--
-Exception: Unsupported operand types: array - array
+TypeError: Unsupported operand types: array - array

 Fatal error: Uncaught TypeError: Unsupported operand types: array - array in %s:%d
 Stack trace:
diff --git a/Zend/tests/switch/bug80046.phpt b/Zend/tests/switch/bug80046.phpt
index 87a493c2030..9964826c5ec 100644
--- a/Zend/tests/switch/bug80046.phpt
+++ b/Zend/tests/switch/bug80046.phpt
@@ -13,10 +13,10 @@ function test($foo) {
 }
 try {
     test('Foo');
-} catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Default
+Exception: Default
diff --git a/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt b/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt
index 95d2fc1233d..950c092c268 100644
--- a/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt
+++ b/Zend/tests/temporary_cleaning/temporary_cleaning_012.phpt
@@ -11,10 +11,10 @@ public static function test() {

 try {
     Foo::test();
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Access to undeclared static property Foo::$property
+Error: Access to undeclared static property Foo::$property
diff --git a/Zend/tests/this-reserved/this_in_extract.phpt b/Zend/tests/this-reserved/this_in_extract.phpt
index 2e3f7b497fd..5db09b7d700 100644
--- a/Zend/tests/this-reserved/this_in_extract.phpt
+++ b/Zend/tests/this-reserved/this_in_extract.phpt
@@ -5,15 +5,15 @@
 function foo() {
     try {
         extract(["this"=>42, "a"=>24]);
-    } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     var_dump($a);
 }
 foo();
 ?>
 --EXPECTF--
-Cannot re-assign $this
+Error: Cannot re-assign $this

 Warning: Undefined variable $a in %s on line %d
 NULL
diff --git a/Zend/tests/throw/001.phpt b/Zend/tests/throw/001.phpt
index ba2406c6d38..906e812d29b 100644
--- a/Zend/tests/throw/001.phpt
+++ b/Zend/tests/throw/001.phpt
@@ -6,93 +6,93 @@
 try {
     $result = true && throw new Exception("true && throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = false && throw new Exception("false && throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = true and throw new Exception("true and throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = false and throw new Exception("false and throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = true || throw new Exception("true || throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = false || throw new Exception("false || throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = true or throw new Exception("true or throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = false or throw new Exception("false or throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = null ?? throw new Exception("null ?? throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = "foo" ?? throw new Exception('"foo" ?? throw');
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = null ?: throw new Exception("null ?: throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = "foo" ?: throw new Exception('"foo" ?: throw');
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $callable = fn() => throw new Exception("fn() => throw");
     var_dump("not yet");
     $callable();
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $result = "bar";
@@ -106,28 +106,28 @@
         throw new Exception("exception 1"),
         throw new Exception("exception 2")
     );
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = true ? true : throw new Exception("true ? true : throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $result = false ? true : throw new Exception("false ? true : throw");
     var_dump($result);
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     throw new Exception() + 1;
 } catch (Throwable $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
@@ -143,31 +143,31 @@

 try {
     throw null ?? new Exception('throw null ?? new Exception();');
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-string(13) "true && throw"
+Exception: true && throw
 bool(false)
-string(14) "true and throw"
+Exception: true and throw
 bool(false)
 bool(true)
-string(14) "false || throw"
+Exception: false || throw
 bool(true)
-string(14) "false or throw"
-string(13) "null ?? throw"
+Exception: false or throw
+Exception: null ?? throw
 string(3) "foo"
-string(13) "null ?: throw"
+Exception: null ?: throw
 string(3) "foo"
 string(7) "not yet"
-string(13) "fn() => throw"
+Exception: fn() => throw
 string(3) "bar"
-string(11) "exception 1"
+Exception: exception 1
 bool(true)
-string(20) "false ? true : throw"
-string(42) "Unsupported operand types: Exception + int"
+Exception: false ? true : throw
+TypeError: Unsupported operand types: Exception + int
 string(35) "throw $exception = new Exception();"
 string(37) "throw $exception ??= new Exception();"
-string(30) "throw null ?? new Exception();"
+Exception: throw null ?? new Exception();
diff --git a/Zend/tests/throw/002.phpt b/Zend/tests/throw/002.phpt
index e80dfbb7d14..b38bc7c717f 100644
--- a/Zend/tests/throw/002.phpt
+++ b/Zend/tests/throw/002.phpt
@@ -23,62 +23,62 @@ public static function staticThrowException() {

 try {
     (new Foo())->throwException();
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     Foo::staticThrowException();
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     throw true ? new Exception('Ternary true 1') : new Exception('Ternary true 2');
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     throw false ? new Exception('Ternary false 1') : new Exception('Ternary false 2');
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $exception1 = new Exception('Coalesce non-null 1');
     $exception2 = new Exception('Coalesce non-null 2');
     throw $exception1 ?? $exception2;
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $exception1 = null;
     $exception2 = new Exception('Coalesce null 2');
     throw $exception1 ?? $exception2;
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     throw $exception = new Exception('Assignment');
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $exception = null;
     throw $exception ??= new Exception('Coalesce assignment null');
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $exception = new Exception('Coalesce assignment non-null 1');
     throw $exception ??= new Exception('Coalesce assignment non-null 2');
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $andConditionalTest = function ($condition1, $condition2) {
@@ -89,40 +89,40 @@ public static function staticThrowException() {

 try {
     $andConditionalTest(false, false);
-} catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch(Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $andConditionalTest(false, true);
-} catch (Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $andConditionalTest(true, false);
-} catch (Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $andConditionalTest(true, true);
-} catch (Exception $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Not found
-Static not found
-Ternary true 1
-Ternary false 2
-Coalesce non-null 1
-Coalesce null 2
-Assignment
-Coalesce assignment null
-Coalesce assignment non-null 1
-And in conditional 2
-And in conditional 2
-And in conditional 2
-And in conditional 1
+Exception: Not found
+Exception: Static not found
+Exception: Ternary true 1
+Exception: Ternary false 2
+Exception: Coalesce non-null 1
+Exception: Coalesce null 2
+Exception: Assignment
+Exception: Coalesce assignment null
+Exception: Coalesce assignment non-null 1
+Exception: And in conditional 2
+Exception: And in conditional 2
+Exception: And in conditional 2
+Exception: And in conditional 1
diff --git a/Zend/tests/throwing_overloaded_compound_assign_op.phpt b/Zend/tests/throwing_overloaded_compound_assign_op.phpt
index 39c38627076..7f127701ee6 100644
--- a/Zend/tests/throwing_overloaded_compound_assign_op.phpt
+++ b/Zend/tests/throwing_overloaded_compound_assign_op.phpt
@@ -15,22 +15,22 @@ public function __get($k) {
 $test[0] = 42;
 try {
     $test[0] %= 0;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($test);

 $test2 = new Test;
 try {
     $test2->prop %= 0;
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($test2);

 ?>
 --EXPECT--
-Modulo by zero
+DivisionByZeroError: Modulo by zero
 object(ArrayObject)#1 (1) {
   ["storage":"ArrayObject":private]=>
   array(1) {
@@ -38,7 +38,7 @@ public function __get($k) {
     int(42)
   }
 }
-Modulo by zero
+DivisionByZeroError: Modulo by zero
 object(Test)#3 (1) {
   ["prop"]=>
   int(42)
diff --git a/Zend/tests/traits/gh_17728.phpt b/Zend/tests/traits/gh_17728.phpt
index ef458a8e8d5..a42231f6004 100644
--- a/Zend/tests/traits/gh_17728.phpt
+++ b/Zend/tests/traits/gh_17728.phpt
@@ -15,10 +15,10 @@ public static function __callStatic($method, $args) {

 try {
     Foo::bar();
-} catch (ErrorException $e) {
-    echo $e->getMessage(), PHP_EOL;
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Calling static trait method Foo::bar is deprecated, it should only be called on a class using the trait
+ErrorException: Calling static trait method Foo::bar is deprecated, it should only be called on a class using the trait
diff --git a/Zend/tests/traits/trait_type_errors.phpt b/Zend/tests/traits/trait_type_errors.phpt
index d3c7c0582fb..7d6a2d59802 100644
--- a/Zend/tests/traits/trait_type_errors.phpt
+++ b/Zend/tests/traits/trait_type_errors.phpt
@@ -22,22 +22,22 @@ class P extends C {
 $c = new C;
 try {
     $c->test1("foo");
-} catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $c->test2("foo");
-} catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $c->test3("foo");
-} catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-C::test1(): Return value must be of type int, string returned
-C::test2(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d
-C::test3(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d
+TypeError: C::test1(): Return value must be of type int, string returned
+TypeError: C::test2(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d
+TypeError: C::test3(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d
diff --git a/Zend/tests/trigger_error_basic.phpt b/Zend/tests/trigger_error_basic.phpt
index d492590bcd9..f8d5209f9e0 100644
--- a/Zend/tests/trigger_error_basic.phpt
+++ b/Zend/tests/trigger_error_basic.phpt
@@ -7,13 +7,13 @@

 try {
     var_dump(trigger_error("error", -1));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(trigger_error("error", 0));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(trigger_error("error", E_USER_WARNING));
@@ -23,8 +23,8 @@
 --EXPECTF--
 Notice: error in %s on line %d
 bool(true)
-trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
-trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
+ValueError: trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
+ValueError: trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED

 Warning: error in %s on line %d
 bool(true)
diff --git a/Zend/tests/try/bug70228_3.phpt b/Zend/tests/try/bug70228_3.phpt
index 80a0f379765..d29d0cd89b1 100644
--- a/Zend/tests/try/bug70228_3.phpt
+++ b/Zend/tests/try/bug70228_3.phpt
@@ -19,14 +19,14 @@ function test() {

 try {
     var_dump(test());
-} catch (Exception $e) {
+} catch (Throwable $e) {
     do {
-        echo $e->getMessage() . "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
         $e = $e->getPrevious();
     } while ($e);
 }
 ?>
 --EXPECTF--
 Deprecated: Returning from a finally block is deprecated in %s on line %d
-2
-1
+Exception: 2
+Exception: 1
diff --git a/Zend/tests/try/bug70228_4.phpt b/Zend/tests/try/bug70228_4.phpt
index 7e0fd78707d..245433209de 100644
--- a/Zend/tests/try/bug70228_4.phpt
+++ b/Zend/tests/try/bug70228_4.phpt
@@ -21,13 +21,13 @@ function test() {

 try {
     var_dump(test());
-} catch (Exception $e) {
+} catch (Throwable $e) {
     do {
-        echo $e->getMessage() . "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
         $e = $e->getPrevious();
     } while ($e);
 }
 ?>
 --EXPECTF--
 Deprecated: Returning from a finally block is deprecated in %s on line %d
-1
+Exception: 1
diff --git a/Zend/tests/try/bug70228_5.phpt b/Zend/tests/try/bug70228_5.phpt
index 29cbf4910de..b5aa085d527 100644
--- a/Zend/tests/try/bug70228_5.phpt
+++ b/Zend/tests/try/bug70228_5.phpt
@@ -12,9 +12,9 @@ function test() {

 try {
     test();
-} catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-ops
+Exception: ops
diff --git a/Zend/tests/try/bug72213.phpt b/Zend/tests/try/bug72213.phpt
index 50555f53e41..ba53b3bb037 100644
--- a/Zend/tests/try/bug72213.phpt
+++ b/Zend/tests/try/bug72213.phpt
@@ -15,11 +15,11 @@ function test() {

 try {
     test();
-} catch (Exception $e) {
-    var_dump($e->getMessage());
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
     var_dump($e->getPrevious()->getMessage());
 }
 ?>
 --EXPECT--
-string(1) "b"
+Exception: b
 string(1) "a"
diff --git a/Zend/tests/try/bug72213_2.phpt b/Zend/tests/try/bug72213_2.phpt
index a9b5f1490b2..df5b8aad484 100644
--- a/Zend/tests/try/bug72213_2.phpt
+++ b/Zend/tests/try/bug72213_2.phpt
@@ -18,9 +18,9 @@ function test() {

 try {
     test();
-} catch (Exception $e) {
-    echo "caught {$e->getMessage()}\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-caught 1
+Exception: 1
diff --git a/Zend/tests/try/catch_finally_006.phpt b/Zend/tests/try/catch_finally_006.phpt
index 463ce377f0a..fca1371fb67 100644
--- a/Zend/tests/try/catch_finally_006.phpt
+++ b/Zend/tests/try/catch_finally_006.phpt
@@ -17,9 +17,9 @@ function foo ($a) {

 try {
    var_dump(foo("para"));
-} catch (Exception $e) {
+} catch (Throwable $e) {
     "caught exception" . PHP_EOL;
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
diff --git a/Zend/tests/try/try_finally_002.phpt b/Zend/tests/try/try_finally_002.phpt
index 99a34f62fbd..a857f1e48a2 100644
--- a/Zend/tests/try/try_finally_002.phpt
+++ b/Zend/tests/try/try_finally_002.phpt
@@ -12,12 +12,12 @@ function foo () {

 try {
   foo();
-} catch (Exception $e) {
+} catch (Throwable $e) {
   do {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
   } while ($e = $e->getPrevious());
 }
 ?>
 --EXPECT--
-string(7) "finally"
-string(3) "try"
+Exception: finally
+Exception: try
diff --git a/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt b/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt
index 3f720ba2b47..d1fee2ce2c4 100644
--- a/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt
+++ b/Zend/tests/type_coercion/float_to_int/union_int_string_type_arg_promote_exception.phpt
@@ -11,10 +11,10 @@ function test(int|string $arg) {}

 try {
     test(0.5);
-} catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Implicit conversion from float 0.5 to int loses precision
+Exception: Implicit conversion from float 0.5 to int loses precision
diff --git a/Zend/tests/type_coercion/gh22112.phpt b/Zend/tests/type_coercion/gh22112.phpt
index 84fdc393a82..68e097894b5 100644
--- a/Zend/tests/type_coercion/gh22112.phpt
+++ b/Zend/tests/type_coercion/gh22112.phpt
@@ -19,17 +19,17 @@ function take_string(string $v) {

 try {
     take_bool($nan);
-} catch (Exception $e) {
-    echo "bool: ", $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo 'bool: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     take_string($nan);
-} catch (Exception $e) {
-    echo "string: ", $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo 'string: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-bool: unexpected NAN value was coerced to bool
-string: unexpected NAN value was coerced to string
+bool: Exception: unexpected NAN value was coerced to bool
+string: Exception: unexpected NAN value was coerced to string
diff --git a/Zend/tests/type_coercion/settype/settype_resource.phpt b/Zend/tests/type_coercion/settype/settype_resource.phpt
index fa9ca739fa9..355b2362b85 100644
--- a/Zend/tests/type_coercion/settype/settype_resource.phpt
+++ b/Zend/tests/type_coercion/settype/settype_resource.phpt
@@ -32,8 +32,8 @@ function  __toString() {
 foreach ($vars as $var) {
     try {
         settype($var, "resource");
-    } catch (ValueError $exception) {
-        echo $exception->getMessage() . "\n";
+    } catch (Throwable $exception) {
+        echo $exception::class, ': ', $exception->getMessage(), "\n";
     }
     var_dump($var);
 }
@@ -41,22 +41,22 @@ function  __toString() {
 echo "Done\n";
 ?>
 --EXPECTF--
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 string(6) "string"
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 string(7) "8754456"
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 string(0) ""
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 string(1) "%0"
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 int(9876545)
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 float(0.1)
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 array(0) {
 }
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 array(3) {
   [0]=>
   int(1)
@@ -65,15 +65,15 @@ function  __toString() {
   [2]=>
   int(3)
 }
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 bool(false)
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 bool(true)
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 NULL
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 resource(%d) of type (stream)
-Cannot convert to resource type
+ValueError: Cannot convert to resource type
 object(test)#%d (0) {
 }
 Done
diff --git a/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt b/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt
index 17921e5ae53..73fea49fb20 100644
--- a/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt
+++ b/Zend/tests/type_coercion/settype/settype_string_nan_with_error_handler2.phpt
@@ -18,4 +18,4 @@
 --EXPECT--
 float(NAN)
 unexpected NAN value was coerced to string
-string(3) "NAN"
\ No newline at end of file
+string(3) "NAN"
diff --git a/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt b/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt
index 26911bddb7e..64e1fc6ad05 100644
--- a/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt
+++ b/Zend/tests/type_coercion/type_casts/cast_to_void_ast.phpt
@@ -7,12 +7,12 @@
     assert(false && function () {
         (void) somefunc();
     });
-} catch (Error $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-assert(false && function () {
+AssertionError: assert(false && function () {
     (void)somefunc();
 })
diff --git a/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt b/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt
index 6375c60ab71..72c2eb0f6d0 100644
--- a/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt
+++ b/Zend/tests/type_declarations/dnf_types/dnf_2_intersection.phpt
@@ -40,13 +40,13 @@ function bar2(): (W&Z)|(X&Y) {

 try {
     bar1();
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bar2();
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -59,5 +59,5 @@ function bar2(): (W&Z)|(X&Y) {
 }
 object(B)#%d (0) {
 }
-bar1(): Return value must be of type (X&Y)|(W&Z), C returned
-bar2(): Return value must be of type (W&Z)|(X&Y), C returned
+TypeError: bar1(): Return value must be of type (X&Y)|(W&Z), C returned
+TypeError: bar2(): Return value must be of type (W&Z)|(X&Y), C returned
diff --git a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt
index e9089c130b4..e5eaed0fd63 100644
--- a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt
+++ b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_null.phpt
@@ -39,23 +39,23 @@ public function foo2(null|(X&Y) $v): null|(X&Y) {
 $c = new C();
 try {
     $test->foo1($c);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->foo2($c);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->prop1 = $c;
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->prop2 = $c;
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -67,8 +67,8 @@ public function foo2(null|(X&Y) $v): null|(X&Y) {
 }
 NULL
 NULL
-Test::foo1(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d
-Test::foo2(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d
-Cannot assign C to property Test::$prop1 of type (X&Y)|null
-Cannot assign C to property Test::$prop2 of type (X&Y)|null
+TypeError: Test::foo1(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d
+TypeError: Test::foo2(): Argument #1 ($v) must be of type (X&Y)|null, C given, called in %s on line %d
+TypeError: Cannot assign C to property Test::$prop1 of type (X&Y)|null
+TypeError: Cannot assign C to property Test::$prop2 of type (X&Y)|null
 ===DONE===
diff --git a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt
index 4c9a5f95e30..40c53e044db 100644
--- a/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt
+++ b/Zend/tests/type_declarations/dnf_types/dnf_intersection_and_single.phpt
@@ -60,43 +60,43 @@ public function bar2((X&Y)|B $v): (X&Y)|B {
 $c = new C();
 try {
     $test->foo1($c);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->foo2($c);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->bar1($c);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->bar2($c);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->prop1 = $c;
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->prop2 = $c;
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->prop3 = $c;
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $test->prop4 = $c;
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -116,12 +116,12 @@ public function bar2((X&Y)|B $v): (X&Y)|B {
 }
 object(B)#3 (0) {
 }
-Test::foo1(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d
-Test::foo2(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d
-Test::bar1(): Argument #1 ($v) must be of type B|(X&Y), C given, called in %s on line %d
-Test::bar2(): Argument #1 ($v) must be of type (X&Y)|B, C given, called in %s on line %d
-Cannot assign C to property Test::$prop1 of type (X&Y)|int
-Cannot assign C to property Test::$prop2 of type (X&Y)|int
-Cannot assign C to property Test::$prop3 of type (X&Y)|B
-Cannot assign C to property Test::$prop4 of type B|(X&Y)
+TypeError: Test::foo1(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d
+TypeError: Test::foo2(): Argument #1 ($v) must be of type (X&Y)|int, C given, called in %s on line %d
+TypeError: Test::bar1(): Argument #1 ($v) must be of type B|(X&Y), C given, called in %s on line %d
+TypeError: Test::bar2(): Argument #1 ($v) must be of type (X&Y)|B, C given, called in %s on line %d
+TypeError: Cannot assign C to property Test::$prop1 of type (X&Y)|int
+TypeError: Cannot assign C to property Test::$prop2 of type (X&Y)|int
+TypeError: Cannot assign C to property Test::$prop3 of type (X&Y)|B
+TypeError: Cannot assign C to property Test::$prop4 of type B|(X&Y)
 ===DONE===
diff --git a/Zend/tests/type_declarations/dnf_types/gh9516.phpt b/Zend/tests/type_declarations/dnf_types/gh9516.phpt
index 3d91932ebd4..db400d2535c 100644
--- a/Zend/tests/type_declarations/dnf_types/gh9516.phpt
+++ b/Zend/tests/type_declarations/dnf_types/gh9516.phpt
@@ -25,28 +25,28 @@ public function method4(D|(B&A) $arg): void {}
     $t->method1(new A_);
     echo 'Fail', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method1(new B_);
     echo 'Fail', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method1(new AB_);
     echo 'Pass', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method1(new D_);
     echo 'Pass', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 // Lets try in reverse?
@@ -54,28 +54,28 @@ public function method4(D|(B&A) $arg): void {}
     $t->method2(new A_);
     echo 'Fail', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method2(new B_);
     echo 'Fail', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method2(new AB_);
     echo 'Pass', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method2(new D_);
     echo 'Pass', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 /* Single before intersection */
@@ -83,28 +83,28 @@ public function method4(D|(B&A) $arg): void {}
     $t->method3(new A_);
     echo 'Fail', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method3(new B_);
     echo 'Fail', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method3(new AB_);
     echo 'Pass', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method3(new D_);
     echo 'Pass', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 // Lets try in reverse?
@@ -112,46 +112,46 @@ public function method4(D|(B&A) $arg): void {}
     $t->method4(new A_);
     echo 'Fail', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method4(new B_);
     echo 'Fail', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method4(new AB_);
     echo 'Pass', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }

 try {
     $t->method4(new D_);
     echo 'Pass', \PHP_EOL;
 } catch (\Throwable $throwable) {
-    echo $throwable->getMessage(), \PHP_EOL;
+    echo $throwable::class, ': ', $throwable->getMessage(), "\n";
 }


 ?>
 --EXPECTF--
-T::method1(): Argument #1 ($arg) must be of type (A&B)|D, A_ given, called in %s on line %d
-T::method1(): Argument #1 ($arg) must be of type (A&B)|D, B_ given, called in %s on line %d
+TypeError: T::method1(): Argument #1 ($arg) must be of type (A&B)|D, A_ given, called in %s on line %d
+TypeError: T::method1(): Argument #1 ($arg) must be of type (A&B)|D, B_ given, called in %s on line %d
 Pass
 Pass
-T::method2(): Argument #1 ($arg) must be of type (B&A)|D, A_ given, called in %s on line %d
-T::method2(): Argument #1 ($arg) must be of type (B&A)|D, B_ given, called in %s on line %d
+TypeError: T::method2(): Argument #1 ($arg) must be of type (B&A)|D, A_ given, called in %s on line %d
+TypeError: T::method2(): Argument #1 ($arg) must be of type (B&A)|D, B_ given, called in %s on line %d
 Pass
 Pass
-T::method3(): Argument #1 ($arg) must be of type D|(A&B), A_ given, called in %s on line %d
-T::method3(): Argument #1 ($arg) must be of type D|(A&B), B_ given, called in %s on line %d
+TypeError: T::method3(): Argument #1 ($arg) must be of type D|(A&B), A_ given, called in %s on line %d
+TypeError: T::method3(): Argument #1 ($arg) must be of type D|(A&B), B_ given, called in %s on line %d
 Pass
 Pass
-T::method4(): Argument #1 ($arg) must be of type D|(B&A), A_ given, called in %s on line %d
-T::method4(): Argument #1 ($arg) must be of type D|(B&A), B_ given, called in %s on line %d
+TypeError: T::method4(): Argument #1 ($arg) must be of type D|(B&A), A_ given, called in %s on line %d
+TypeError: T::method4(): Argument #1 ($arg) must be of type D|(B&A), B_ given, called in %s on line %d
 Pass
 Pass
diff --git a/Zend/tests/type_declarations/internal_function_strict_mode.phpt b/Zend/tests/type_declarations/internal_function_strict_mode.phpt
index 5b2ad90abfe..da9ce52ce16 100644
--- a/Zend/tests/type_declarations/internal_function_strict_mode.phpt
+++ b/Zend/tests/type_declarations/internal_function_strict_mode.phpt
@@ -7,29 +7,29 @@
 echo "*** Trying Ord With Integer" . PHP_EOL;
 try {
     var_dump(ord(1));
-} catch (TypeError $e) {
-    echo "*** Caught " . $e->getMessage() . PHP_EOL;
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "*** Trying Array Map With Invalid Callback" . PHP_EOL;
 try {
     array_map([null, "bar"], []);
-} catch (TypeError $e) {
-    echo "*** Caught " . $e->getMessage() . PHP_EOL;
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "*** Trying Strlen With Float" . PHP_EOL;
 try {
     var_dump(strlen(1.5));
-} catch (TypeError $e) {
-    echo "*** Caught " . $e->getMessage() . PHP_EOL;
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
 *** Trying Ord With Integer
-*** Caught ord(): Argument #1 ($character) must be of type string, int given
+TypeError: ord(): Argument #1 ($character) must be of type string, int given
 *** Trying Array Map With Invalid Callback
-*** Caught array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object
+TypeError: array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object
 *** Trying Strlen With Float
-*** Caught strlen(): Argument #1 ($string) must be of type string, float given
+TypeError: strlen(): Argument #1 ($string) must be of type string, float given
diff --git a/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt b/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt
index 568e6e25afa..7490bcd8434 100644
--- a/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt
+++ b/Zend/tests/type_declarations/intersection_types/assigning_intersection_types.phpt
@@ -28,8 +28,8 @@ public function method2(X $a): X&Y {
 $o = new A();
 try {
     $o->prop = $tp;
-} catch (TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $o->prop = $tc;
@@ -46,7 +46,7 @@ public function method2(X $a): X&Y {

 ?>
 --EXPECTF--
-Cannot assign TestParent to property A::$prop of type X&Y&Z
+TypeError: Cannot assign TestParent to property A::$prop of type X&Y&Z
 object(TestChild)#%d (0) {
 }
 object(TestParent)#%d (0) {
diff --git a/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt b/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt
index 83af5e96ccf..c268720d4c2 100644
--- a/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt
+++ b/Zend/tests/type_declarations/intersection_types/implicit_nullable_intersection_type_error.phpt
@@ -9,11 +9,11 @@ function foo(X&Y $foo = null) {

 try {
     foo(5);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
 Deprecated: foo(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in %s on line %d
-foo(): Argument #1 ($foo) must be of type (X&Y)|null, int given, called in %s on line %d
+TypeError: foo(): Argument #1 ($foo) must be of type (X&Y)|null, int given, called in %s on line %d
diff --git a/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt b/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt
index e724e1b15f5..5123be36f13 100644
--- a/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt
+++ b/Zend/tests/type_declarations/intersection_types/missing_interface_intersection_type.phpt
@@ -24,8 +24,8 @@ function bar(X&Y $o): void {
 try {
     $o = foo();
     var_dump($o);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $c = new Collection();
@@ -33,18 +33,18 @@ function bar(X&Y $o): void {

 try {
     $c->intersect = $a;
-} catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     bar($a);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-foo(): Return value must be of type X&Y, A returned
-Cannot assign A to property Collection::$intersect of type X&Y
-bar(): Argument #1 ($o) must be of type X&Y, A given, called in %s on line %d
+TypeError: foo(): Return value must be of type X&Y, A returned
+TypeError: Cannot assign A to property Collection::$intersect of type X&Y
+TypeError: bar(): Argument #1 ($o) must be of type X&Y, A given, called in %s on line %d
diff --git a/Zend/tests/type_declarations/intersection_types/parameter.phpt b/Zend/tests/type_declarations/intersection_types/parameter.phpt
index d1c7de22436..2de2d5b91ed 100644
--- a/Zend/tests/type_declarations/intersection_types/parameter.phpt
+++ b/Zend/tests/type_declarations/intersection_types/parameter.phpt
@@ -17,12 +17,12 @@ function foo(A&B $bar) {

 try {
     foo(new Bar());
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
 object(Foo)#1 (0) {
 }
-foo(): Argument #1 ($bar) must be of type A&B, Bar given, called in %s on line %d
+TypeError: foo(): Argument #1 ($bar) must be of type A&B, Bar given, called in %s on line %d
diff --git a/Zend/tests/type_declarations/intersection_types/typed_reference.phpt b/Zend/tests/type_declarations/intersection_types/typed_reference.phpt
index 2ceb34f256f..b16dfad4025 100644
--- a/Zend/tests/type_declarations/intersection_types/typed_reference.phpt
+++ b/Zend/tests/type_declarations/intersection_types/typed_reference.phpt
@@ -21,10 +21,10 @@ class Test {

 try {
     $r = new B;
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Cannot assign B to reference held by property Test::$z of type X&Z
+TypeError: Cannot assign B to reference held by property Test::$z of type X&Z
diff --git a/Zend/tests/type_declarations/iterable/iterable_001.phpt b/Zend/tests/type_declarations/iterable/iterable_001.phpt
index 7c127c8e1df..c264908fbb5 100644
--- a/Zend/tests/type_declarations/iterable/iterable_001.phpt
+++ b/Zend/tests/type_declarations/iterable/iterable_001.phpt
@@ -20,7 +20,7 @@ function gen() {
 try {
     test(1);
 } catch (Throwable $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
@@ -47,4 +47,4 @@ function gen() {
     int(3)
   }
 }
-test(): Argument #1 ($iterable) must be of type Traversable|array, int given, called in %s on line %d
+TypeError: test(): Argument #1 ($iterable) must be of type Traversable|array, int given, called in %s on line %d
diff --git a/Zend/tests/type_declarations/iterable/iterable_003.phpt b/Zend/tests/type_declarations/iterable/iterable_003.phpt
index a2c96995da3..978f177fc4b 100644
--- a/Zend/tests/type_declarations/iterable/iterable_003.phpt
+++ b/Zend/tests/type_declarations/iterable/iterable_003.phpt
@@ -20,7 +20,7 @@ function baz(): iterable {
 try {
     baz();
 } catch (Throwable $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -31,4 +31,4 @@ function baz(): iterable {
   ["function"]=>
   string(17) "{closure:bar():7}"
 }
-baz(): Return value must be of type Traversable|array, int returned
+TypeError: baz(): Return value must be of type Traversable|array, int returned
diff --git a/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt b/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt
index 61900f993c0..86eb1aee258 100644
--- a/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt
+++ b/Zend/tests/type_declarations/literal_types/false_no_coercion.phpt
@@ -7,22 +7,22 @@ function test(false $v) { var_dump($v); }

 try {
     test(0);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     test('');
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     test([]);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-test(): Argument #1 ($v) must be of type false, int given, called in %s on line %d
-test(): Argument #1 ($v) must be of type false, string given, called in %s on line %d
-test(): Argument #1 ($v) must be of type false, array given, called in %s on line %d
+TypeError: test(): Argument #1 ($v) must be of type false, int given, called in %s on line %d
+TypeError: test(): Argument #1 ($v) must be of type false, string given, called in %s on line %d
+TypeError: test(): Argument #1 ($v) must be of type false, array given, called in %s on line %d
diff --git a/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt b/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt
index 726245705ff..34480f91f1e 100644
--- a/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt
+++ b/Zend/tests/type_declarations/literal_types/false_no_coercion_on_overload.phpt
@@ -21,11 +21,11 @@ public function foo($v): array|false {
 var_dump($p->foo(0));
 try {
     var_dump($c->foo(0));
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
 bool(false)
-C::foo(): Return value must be of type array|false, int returned
+TypeError: C::foo(): Return value must be of type array|false, int returned
diff --git a/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt b/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt
index 85d6c90cd05..72e9ae88980 100644
--- a/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt
+++ b/Zend/tests/type_declarations/literal_types/true_no_coercion.phpt
@@ -7,28 +7,28 @@ function test(true $v) { var_dump($v); }

 try {
     test(1);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     test('1');
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     test([1]);
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     test(new stdClass());
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-test(): Argument #1 ($v) must be of type true, int given, called in %s on line %d
-test(): Argument #1 ($v) must be of type true, string given, called in %s on line %d
-test(): Argument #1 ($v) must be of type true, array given, called in %s on line %d
-test(): Argument #1 ($v) must be of type true, stdClass given, called in %s on line %d
+TypeError: test(): Argument #1 ($v) must be of type true, int given, called in %s on line %d
+TypeError: test(): Argument #1 ($v) must be of type true, string given, called in %s on line %d
+TypeError: test(): Argument #1 ($v) must be of type true, array given, called in %s on line %d
+TypeError: test(): Argument #1 ($v) must be of type true, stdClass given, called in %s on line %d
diff --git a/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt b/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt
index 7eebe1e3571..a0ed9bf12d8 100644
--- a/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt
+++ b/Zend/tests/type_declarations/literal_types/true_no_coercion_on_overload.phpt
@@ -21,11 +21,11 @@ public function foo($v): array|true {
 var_dump($p->foo(1));
 try {
     var_dump($c->foo(1));
-} catch (\TypeError $e) {
-    echo $e->getMessage(), \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
 bool(true)
-C::foo(): Return value must be of type array|true, int returned
+TypeError: C::foo(): Return value must be of type array|true, int returned
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt
index 8a2c6000205..edd4d59f580 100644
--- a/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt
@@ -27,10 +27,10 @@ public function __construct()

 try {
     $foo->property1;
-} catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Typed property Foo::$property1 must not be accessed before initialization
+Error: Typed property Foo::$property1 must not be accessed before initialization
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt
index e83023d54cf..720e9cdc13a 100644
--- a/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt
@@ -26,10 +26,10 @@ public function __construct()

 try {
     $foo->property1;
-} catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Typed property Foo::$property1 must not be accessed before initialization
+Error: Typed property Foo::$property1 must not be accessed before initialization
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt
index 2bd775af0a4..7712f5e3a0e 100644
--- a/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt
@@ -10,10 +10,10 @@ function foo(): mixed

 try {
     foo();
-} catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-foo(): Return value must be of type mixed, none returned
+TypeError: foo(): Return value must be of type mixed, none returned
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt
index 52bd99beb6c..2e5efe16baa 100644
--- a/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt
@@ -9,10 +9,10 @@ function foo(): mixed

 try {
     foo();
-} catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-foo(): Return value must be of type mixed, none returned
+TypeError: foo(): Return value must be of type mixed, none returned
diff --git a/Zend/tests/type_declarations/scalar_basic.phpt b/Zend/tests/type_declarations/scalar_basic.phpt
index 352c48f8a9e..e6559a94174 100644
--- a/Zend/tests/type_declarations/scalar_basic.phpt
+++ b/Zend/tests/type_declarations/scalar_basic.phpt
@@ -52,8 +52,8 @@ public function __toString() {
         var_dump($value);
         try {
             var_dump($function($value));
-        } catch (\TypeError $e) {
-            echo "*** Caught " . $e->getMessage() . PHP_EOL;
+        } catch (\Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
 }
@@ -76,19 +76,19 @@ public function __toString() {
 int(1)

 *** Trying string(2) "1a"
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d

 *** Trying string(1) "a"
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d

 *** Trying string(0) ""
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d

 *** Trying int(%d)
 int(%d)

 *** Trying float(NAN)
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d

 *** Trying bool(true)
 int(1)
@@ -97,22 +97,22 @@ public function __toString() {
 int(0)

 *** Trying NULL
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d

 *** Trying array(0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d

 *** Trying object(stdClass)#%s (0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d

 *** Trying object(StringCapable)#%s (0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d

 *** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d

 Testing 'float' type:

@@ -129,13 +129,13 @@ public function __toString() {
 float(1.5)

 *** Trying string(2) "1a"
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d

 *** Trying string(1) "a"
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d

 *** Trying string(0) ""
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d

 *** Trying int(%d)
 float(%s)
@@ -150,22 +150,22 @@ public function __toString() {
 float(0)

 *** Trying NULL
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d

 *** Trying array(0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d

 *** Trying object(stdClass)#%s (0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d

 *** Trying object(StringCapable)#%s (0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d

 *** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d

 Testing 'string' type:

@@ -204,22 +204,22 @@ public function __toString() {
 string(0) ""

 *** Trying NULL
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d

 *** Trying array(0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d

 *** Trying object(stdClass)#%s (0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d

 *** Trying object(StringCapable)#%s (0) {
 }
 string(6) "foobar"

 *** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d

 Testing 'bool' type:

@@ -258,21 +258,21 @@ public function __toString() {
 bool(false)

 *** Trying NULL
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d

 *** Trying array(0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d

 *** Trying object(stdClass)#%s (0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d

 *** Trying object(StringCapable)#%s (0) {
 }
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d

 *** Trying resource(%d) of type (stream)
-*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
+TypeError: {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d

 Done
diff --git a/Zend/tests/type_declarations/scalar_constant_defaults.phpt b/Zend/tests/type_declarations/scalar_constant_defaults.phpt
index 5e3826de7dc..10dbab93e7a 100644
--- a/Zend/tests/type_declarations/scalar_constant_defaults.phpt
+++ b/Zend/tests/type_declarations/scalar_constant_defaults.phpt
@@ -64,15 +64,15 @@ function nullable_int_val_default_null(?int $a = NULL_VAL) {
 echo "Testing int with default null constant" . PHP_EOL;
 try {
     var_dump(int_val_default_null());
-} catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Testing int with null null constant" . PHP_EOL;
 try {
     var_dump(int_val_default_null(null));
-} catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Testing nullable int with default null constant" . PHP_EOL;
@@ -96,9 +96,9 @@ function nullable_int_val_default_null(?int $a = NULL_VAL) {
 Testing string add val
 string(14) "this is a test"
 Testing int with default null constant
-int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d
+TypeError: int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d
 Testing int with null null constant
-int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d
+TypeError: int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d
 Testing nullable int with default null constant
 NULL
 Testing nullable int with null null constant