Commit 06a5a1f6d3c for php.net

commit 06a5a1f6d3c9ca9394d1c78603ccdd3774aac223
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date:   Fri Aug 7 19:47:53 2026 +0700

    ext/spl: applied fixers to improve test robustness (#23058)

diff --git a/ext/spl/tests/ArrayObject/ArrayObject_exchange_array_during_sorting.phpt b/ext/spl/tests/ArrayObject/ArrayObject_exchange_array_during_sorting.phpt
index b563c2c84d0..e385ef4922c 100644
--- a/ext/spl/tests/ArrayObject/ArrayObject_exchange_array_during_sorting.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_exchange_array_during_sorting.phpt
@@ -10,7 +10,7 @@
         try {
             $ao->exchangeArray([4, 5, 6]);
         } catch (Error $e) {
-            echo $e->getMessage(), "\n";
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
         var_dump($ao);
     }
@@ -19,7 +19,7 @@

 ?>
 --EXPECT--
-Modification of ArrayObject during sorting is prohibited
+Error: Modification of ArrayObject during sorting is prohibited
 object(ArrayObject)#1 (1) {
   ["storage":"ArrayObject":private]=>
   array(3) {
diff --git a/ext/spl/tests/ArrayObject/ArrayObject_illegal_offset.phpt b/ext/spl/tests/ArrayObject/ArrayObject_illegal_offset.phpt
index a2803e47296..c97e10ed258 100644
--- a/ext/spl/tests/ArrayObject/ArrayObject_illegal_offset.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_illegal_offset.phpt
@@ -7,33 +7,33 @@
 try {
     var_dump($ao[[]]);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $ao[[]] = new stdClass;
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $ref =& $ao[[]];
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(isset($ao[[]]));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     unset($ao[[]]);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Cannot access offset of type array on ArrayObject
-Cannot access offset of type array on ArrayObject
-Cannot access offset of type array on ArrayObject
-Cannot access offset of type array in isset or empty
-Cannot unset offset of type array on ArrayObject
+TypeError: Cannot access offset of type array on ArrayObject
+TypeError: Cannot access offset of type array on ArrayObject
+TypeError: Cannot access offset of type array on ArrayObject
+TypeError: Cannot access offset of type array in isset or empty
+TypeError: Cannot unset offset of type array on ArrayObject
diff --git a/ext/spl/tests/ArrayObject/ArrayObject_overloaded_SplFixedArray.phpt b/ext/spl/tests/ArrayObject/ArrayObject_overloaded_SplFixedArray.phpt
index 13065b4ac38..8ff0b93e79d 100644
--- a/ext/spl/tests/ArrayObject/ArrayObject_overloaded_SplFixedArray.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_overloaded_SplFixedArray.phpt
@@ -9,9 +9,9 @@
   // See GH-15918: this *should* fail to not break invariants
   $ao->exchangeArray($fixedArray);
 } catch (InvalidArgumentException $e) {
-  echo $e->getMessage(), "\n";
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
 Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
-Overloaded object of type SplFixedArray is not compatible with ArrayObject
+InvalidArgumentException: Overloaded object of type SplFixedArray is not compatible with ArrayObject
diff --git a/ext/spl/tests/ArrayObject/ArrayObject_overloaded_object_incompatible.phpt b/ext/spl/tests/ArrayObject/ArrayObject_overloaded_object_incompatible.phpt
index 8cc66facc00..2d8d566f7e5 100644
--- a/ext/spl/tests/ArrayObject/ArrayObject_overloaded_object_incompatible.phpt
+++ b/ext/spl/tests/ArrayObject/ArrayObject_overloaded_object_incompatible.phpt
@@ -7,14 +7,14 @@
 try {
     $ao->exchangeArray(new DateInterval('P1D'));
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($ao);

 ?>
 --EXPECTF--
 Deprecated: ArrayObject::exchangeArray(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
-Overloaded object of type DateInterval is not compatible with ArrayObject
+InvalidArgumentException: Overloaded object of type DateInterval is not compatible with ArrayObject
 object(ArrayObject)#1 (1) {
   ["storage":"ArrayObject":private]=>
   array(3) {
diff --git a/ext/spl/tests/ArrayObject/arrayObject___construct_error1.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_error1.phpt
index a9fbc9d3b03..78660694d53 100644
--- a/ext/spl/tests/ArrayObject/arrayObject___construct_error1.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject___construct_error1.phpt
@@ -8,18 +8,18 @@
 try {
   var_dump(new ArrayObject($a, 0, "Exception"));
 } catch (TypeError $e) {
-  echo $e->getMessage() . "(" . $e->getLine() .  ")\n";
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Non-existent class:\n";
 try {
   var_dump(new ArrayObject(new stdClass, 0, "nonExistentClassName"));
 } catch (TypeError $e) {
-  echo $e->getMessage() . "(" . $e->getLine() .  ")\n";
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
 Bad iterator type:
-ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, Exception given(6)
+TypeError: ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, Exception given
 Non-existent class:
-ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, nonExistentClassName given(13)
+TypeError: ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, nonExistentClassName given
diff --git a/ext/spl/tests/ArrayObject/arrayObject___construct_error2.phpt b/ext/spl/tests/ArrayObject/arrayObject___construct_error2.phpt
index c3804f0d0af..4624d0d3b1d 100644
--- a/ext/spl/tests/ArrayObject/arrayObject___construct_error2.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject___construct_error2.phpt
@@ -14,9 +14,9 @@ function rewind(): void {}
 try {
   var_dump(new ArrayObject(new stdClass, 0, "C", "extra"));
 } catch (TypeError $e) {
-  echo $e->getMessage() . "(" . $e->getLine() .  ")\n";
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
 Too many arguments:
-ArrayObject::__construct() expects at most 3 arguments, 4 given(12)
+ArgumentCountError: ArrayObject::__construct() expects at most 3 arguments, 4 given
diff --git a/ext/spl/tests/ArrayObject/arrayObject_asort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_asort_basic1.phpt
index efce55d4d58..22f69324fae 100644
--- a/ext/spl/tests/ArrayObject/arrayObject_asort_basic1.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_asort_basic1.phpt
@@ -16,7 +16,7 @@
 try {
     var_dump($ao2->asort('blah'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($ao2);
 var_dump($ao2->asort(SORT_NUMERIC));
@@ -36,7 +36,7 @@
     int(4)
   }
 }
-ArrayObject::asort(): Argument #1 ($flags) must be of type int, string given
+TypeError: ArrayObject::asort(): Argument #1 ($flags) must be of type int, string given
 object(ArrayObject)#%d (1) {
   ["storage":"ArrayObject":private]=>
   array(3) {
diff --git a/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic2.phpt b/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic2.phpt
index 4ba09cd388f..8a7cbe5d9ab 100644
--- a/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic2.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic2.phpt
@@ -104,4 +104,4 @@
       }
     }
   }
-}
\ No newline at end of file
+}
diff --git a/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic3.phpt
index 8db9b016fda..08569a7194f 100644
--- a/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic3.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_exchangeArray_basic3.phpt
@@ -16,7 +16,7 @@ class C {
     $copy = $ao->exchangeArray($swapIn);
     $copy['addedToCopy'] = 'added To Copy';
 } catch (Exception $e) {
-    echo "Exception:" . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 $swapIn->addedToSwapIn = 'added To Swap-In';
 $original->addedToOriginal = 'added To Original';
@@ -31,7 +31,7 @@ class C {
     $copy = $ao->exchangeArray();
     $copy['addedToCopy'] = 'added To Copy';
 } catch (TypeError $e) {
-    echo "Exception: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 $original->addedToOriginal = 'added To Original';
 var_dump($ao, $original, $copy);
@@ -44,7 +44,7 @@ class C {
     $copy = $ao->exchangeArray(null);
     $copy['addedToCopy'] = 'added To Copy';
 } catch (TypeError $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 $original->addedToOriginal = 'added To Original';
 var_dump($ao, $original, $copy);
@@ -92,7 +92,7 @@ class C {
 --> exchangeArray() with no arg:

 Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
-Exception: ArrayObject::exchangeArray() expects exactly 1 argument, 0 given
+ArgumentCountError: ArrayObject::exchangeArray() expects exactly 1 argument, 0 given

 Deprecated: Creation of dynamic property C::$addedToOriginal is deprecated in %s on line %d

@@ -118,7 +118,7 @@ class C {
 --> exchangeArray() with bad arg type:

 Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
-ArrayObject::exchangeArray(): Argument #1 ($array) must be of type array, null given
+TypeError: ArrayObject::exchangeArray(): Argument #1 ($array) must be of type array, null given

 Deprecated: Creation of dynamic property C::$addedToOriginal is deprecated in %s on line %d

diff --git a/ext/spl/tests/ArrayObject/arrayObject_ksort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_ksort_basic1.phpt
index 27605461cbe..8f8bd605ba3 100644
--- a/ext/spl/tests/ArrayObject/arrayObject_ksort_basic1.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_ksort_basic1.phpt
@@ -15,7 +15,7 @@
 try {
     var_dump($ao2->ksort('blah'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($ao2);
 var_dump($ao2->ksort(SORT_STRING));
@@ -35,7 +35,7 @@
     int(3)
   }
 }
-ArrayObject::ksort(): Argument #1 ($flags) must be of type int, string given
+TypeError: ArrayObject::ksort(): Argument #1 ($flags) must be of type int, string given
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
   array(4) {
diff --git a/ext/spl/tests/ArrayObject/arrayObject_natcasesort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_natcasesort_basic1.phpt
index 9949fbda06a..31ebae0e811 100644
--- a/ext/spl/tests/ArrayObject/arrayObject_natcasesort_basic1.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_natcasesort_basic1.phpt
@@ -16,7 +16,7 @@
 try {
     var_dump($ao2->natcasesort('blah'));
 } catch (ArgumentCountError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($ao2);
 ?>
@@ -38,7 +38,7 @@
     string(5) "boo22"
   }
 }
-ArrayObject::natcasesort() expects exactly 0 arguments, 1 given
+ArgumentCountError: ArrayObject::natcasesort() expects exactly 0 arguments, 1 given
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
   array(5) {
diff --git a/ext/spl/tests/ArrayObject/arrayObject_natsort_basic1.phpt b/ext/spl/tests/ArrayObject/arrayObject_natsort_basic1.phpt
index 474c142de0a..6b45a4edd86 100644
--- a/ext/spl/tests/ArrayObject/arrayObject_natsort_basic1.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_natsort_basic1.phpt
@@ -16,7 +16,7 @@
 try {
     var_dump($ao2->natsort('blah'));
 } catch (ArgumentCountError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($ao2);
 ?>
@@ -38,7 +38,7 @@
     string(5) "boo22"
   }
 }
-ArrayObject::natsort() expects exactly 0 arguments, 1 given
+ArgumentCountError: ArrayObject::natsort() expects exactly 0 arguments, 1 given
 object(ArrayObject)#2 (1) {
   ["storage":"ArrayObject":private]=>
   array(5) {
diff --git a/ext/spl/tests/ArrayObject/arrayObject_setIteratorClass_error1.phpt b/ext/spl/tests/ArrayObject/arrayObject_setIteratorClass_error1.phpt
index 9a0e67b6052..1eb8d17ca66 100644
--- a/ext/spl/tests/ArrayObject/arrayObject_setIteratorClass_error1.phpt
+++ b/ext/spl/tests/ArrayObject/arrayObject_setIteratorClass_error1.phpt
@@ -9,7 +9,7 @@
     echo "  $key=>$value\n";
   }
 } catch (TypeError $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
@@ -19,7 +19,7 @@
     echo "  $key=>$value\n";
   }
 } catch (TypeError $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }


@@ -29,7 +29,7 @@
     echo "  $key=>$value\n";
   }
 } catch (TypeError $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
@@ -38,12 +38,12 @@
     echo "  $key=>$value\n";
   }
 } catch (TypeError $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-string(133) "ArrayObject::setIteratorClass(): Argument #1 ($iteratorClass) must be a class name derived from ArrayIterator, nonExistentClass given"
-string(125) "ArrayObject::setIteratorClass(): Argument #1 ($iteratorClass) must be a class name derived from ArrayIterator, stdClass given"
-string(128) "ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, nonExistentClass given"
-string(120) "ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, stdClass given"
+TypeError: ArrayObject::setIteratorClass(): Argument #1 ($iteratorClass) must be a class name derived from ArrayIterator, nonExistentClass given
+TypeError: ArrayObject::setIteratorClass(): Argument #1 ($iteratorClass) must be a class name derived from ArrayIterator, stdClass given
+TypeError: ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, nonExistentClass given
+TypeError: ArrayObject::__construct(): Argument #3 ($iteratorClass) must be a class name derived from ArrayIterator, stdClass given
diff --git a/ext/spl/tests/ArrayObject/array_014.phpt b/ext/spl/tests/ArrayObject/array_014.phpt
index 37ed9abad50..ec061ca135a 100644
--- a/ext/spl/tests/ArrayObject/array_014.phpt
+++ b/ext/spl/tests/ArrayObject/array_014.phpt
@@ -16,7 +16,7 @@
 }
 catch(Exception $e)
 {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try
@@ -26,7 +26,7 @@
 }
 catch(Exception $e)
 {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $pos = 0;
@@ -41,8 +41,8 @@
 int(11)
 int(5)
 int(4)
-Seek position -1 is out of range
-Seek position 12 is out of range
+OutOfBoundsException: Seek position -1 is out of range
+OutOfBoundsException: Seek position 12 is out of range
 int(0)
 int(1)
 int(2)
diff --git a/ext/spl/tests/ArrayObject/array_018.phpt b/ext/spl/tests/ArrayObject/array_018.phpt
index 948e0dca4e5..b6ee252820b 100644
--- a/ext/spl/tests/ArrayObject/array_018.phpt
+++ b/ext/spl/tests/ArrayObject/array_018.phpt
@@ -10,7 +10,7 @@
 }
 catch (Exception $e)
 {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump($foo);
@@ -23,7 +23,7 @@
 }
 catch (Exception $e)
 {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump($foo);
diff --git a/ext/spl/tests/ArrayObject/gh15833_2.phpt b/ext/spl/tests/ArrayObject/gh15833_2.phpt
index 5d7721e25dd..1b21535aed3 100644
--- a/ext/spl/tests/ArrayObject/gh15833_2.phpt
+++ b/ext/spl/tests/ArrayObject/gh15833_2.phpt
@@ -16,27 +16,27 @@ class C {
 try {
     var_dump($recursiveArrayIterator->current());
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($recursiveArrayIterator->current());
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $recursiveArrayIterator->next();
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($recursiveArrayIterator->current());
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
 Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
-nope 0
-nope 1
-nope 2
-nope 3
+Error: nope 0
+Error: nope 1
+Error: nope 2
+Error: nope 3
diff --git a/ext/spl/tests/ArrayObject/gh15918.phpt b/ext/spl/tests/ArrayObject/gh15918.phpt
index 5efdb887f9b..f16d25d54ad 100644
--- a/ext/spl/tests/ArrayObject/gh15918.phpt
+++ b/ext/spl/tests/ArrayObject/gh15918.phpt
@@ -6,9 +6,9 @@
 try {
     $arrayObject = new ArrayObject($foo);
 } catch (InvalidArgumentException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
 Deprecated: ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants in %s on line %d
-Overloaded object of type SplFixedArray is not compatible with ArrayObject
+InvalidArgumentException: Overloaded object of type SplFixedArray is not compatible with ArrayObject
diff --git a/ext/spl/tests/ArrayObject_construct_during_sorting.phpt b/ext/spl/tests/ArrayObject_construct_during_sorting.phpt
index cec41dc92cd..6638c8f5522 100644
--- a/ext/spl/tests/ArrayObject_construct_during_sorting.phpt
+++ b/ext/spl/tests/ArrayObject_construct_during_sorting.phpt
@@ -11,7 +11,7 @@
         try {
             $ao->__construct($other);
         } catch (Error $e) {
-            echo $e->getMessage(), "\n";
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
     return $a <=> $b;
@@ -20,7 +20,7 @@

 ?>
 --EXPECT--
-Modification of ArrayObject during sorting is prohibited
+Error: Modification of ArrayObject during sorting is prohibited
 object(ArrayObject)#1 (1) {
   ["storage":"ArrayObject":private]=>
   array(3) {
diff --git a/ext/spl/tests/CallbackFilterIteratorTest-002.phpt b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
index bba7e0f8a9a..a939b739cdf 100644
--- a/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
+++ b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
@@ -11,25 +11,25 @@
 try {
     new CallbackFilterIterator();
 } catch (TypeError $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     new CallbackFilterIterator(null);
 } catch (TypeError $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     new CallbackFilterIterator(new ArrayIterator(array()), null);
 } catch (TypeError $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     new CallbackFilterIterator(new ArrayIterator(array()), array());
 } catch (TypeError $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $it = new CallbackFilterIterator(new ArrayIterator(array(1)), function() {
@@ -38,12 +38,12 @@
 try {
     foreach($it as $e);
 } catch(Exception $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-CallbackFilterIterator::__construct() expects exactly 2 arguments, 0 given
-CallbackFilterIterator::__construct() expects exactly 2 arguments, 1 given
-CallbackFilterIterator::__construct(): Argument #2 ($callback) must be a valid callback, no array or string given
-CallbackFilterIterator::__construct(): Argument #2 ($callback) must be a valid callback, array callback must have exactly two members
-some message
+ArgumentCountError: CallbackFilterIterator::__construct() expects exactly 2 arguments, 0 given
+ArgumentCountError: CallbackFilterIterator::__construct() expects exactly 2 arguments, 1 given
+TypeError: CallbackFilterIterator::__construct(): Argument #2 ($callback) must be a valid callback, no array or string given
+TypeError: CallbackFilterIterator::__construct(): Argument #2 ($callback) must be a valid callback, array callback must have exactly two members
+Exception: some message
diff --git a/ext/spl/tests/DirectoryIterator_empty_constructor.phpt b/ext/spl/tests/DirectoryIterator_empty_constructor.phpt
index 3db6700d2e9..23d3168c155 100644
--- a/ext/spl/tests/DirectoryIterator_empty_constructor.phpt
+++ b/ext/spl/tests/DirectoryIterator_empty_constructor.phpt
@@ -8,8 +8,8 @@
 try {
     $it = new DirectoryIterator("");
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-DirectoryIterator::__construct(): Argument #1 ($directory) must not be empty
+ValueError: DirectoryIterator::__construct(): Argument #1 ($directory) must not be empty
diff --git a/ext/spl/tests/DirectoryIterator_uninitialized.phpt b/ext/spl/tests/DirectoryIterator_uninitialized.phpt
index cb63b555aab..ea393f5da02 100644
--- a/ext/spl/tests/DirectoryIterator_uninitialized.phpt
+++ b/ext/spl/tests/DirectoryIterator_uninitialized.phpt
@@ -11,9 +11,9 @@ public function __construct() {}
 try {
     $it->key();
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Object not initialized
+Error: Object not initialized
diff --git a/ext/spl/tests/GH-22047.phpt b/ext/spl/tests/GH-22047.phpt
index b01fbfd633c..0a7d66ba52e 100644
--- a/ext/spl/tests/GH-22047.phpt
+++ b/ext/spl/tests/GH-22047.phpt
@@ -13,9 +13,9 @@
         echo "should not reach here\n";
     }
 } catch (UnexpectedValueException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-Cannot deserialize ArrayObject with iterator class 'GlobIterator'; this class is not derived from ArrayIterator
+UnexpectedValueException: Cannot deserialize ArrayObject with iterator class 'GlobIterator'; this class is not derived from ArrayIterator
diff --git a/ext/spl/tests/GlobIterator_constructor_count.phpt b/ext/spl/tests/GlobIterator_constructor_count.phpt
index 5f96be6219d..5a5dd784560 100644
--- a/ext/spl/tests/GlobIterator_constructor_count.phpt
+++ b/ext/spl/tests/GlobIterator_constructor_count.phpt
@@ -7,8 +7,8 @@
 try {
     count($in);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-GlobIterator is not initialized
+Error: GlobIterator is not initialized
diff --git a/ext/spl/tests/RecursiveIteratorIterator_invalid_aggregate.phpt b/ext/spl/tests/RecursiveIteratorIterator_invalid_aggregate.phpt
index e877de6ae02..4e9264739c9 100644
--- a/ext/spl/tests/RecursiveIteratorIterator_invalid_aggregate.phpt
+++ b/ext/spl/tests/RecursiveIteratorIterator_invalid_aggregate.phpt
@@ -13,9 +13,9 @@ function getIterator() {
 try {
     new RecursiveIteratorIterator(new MyIteratorAggregate);
 } catch (LogicException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-MyIteratorAggregate::getIterator() must return an object that implements Traversable
+LogicException: MyIteratorAggregate::getIterator() must return an object that implements Traversable
diff --git a/ext/spl/tests/RecursiveIteratorIterator_not_initialized.phpt b/ext/spl/tests/RecursiveIteratorIterator_not_initialized.phpt
index 4e90692843d..c34122c11ac 100644
--- a/ext/spl/tests/RecursiveIteratorIterator_not_initialized.phpt
+++ b/ext/spl/tests/RecursiveIteratorIterator_not_initialized.phpt
@@ -8,9 +8,9 @@
 try {
     foreach ($it as $v) {}
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Object is not initialized
+Error: Object is not initialized
diff --git a/ext/spl/tests/SPLDoublyLinkedList_iterate_by_reference.phpt b/ext/spl/tests/SPLDoublyLinkedList_iterate_by_reference.phpt
index 769136c4064..385d9590485 100644
--- a/ext/spl/tests/SPLDoublyLinkedList_iterate_by_reference.phpt
+++ b/ext/spl/tests/SPLDoublyLinkedList_iterate_by_reference.phpt
@@ -18,9 +18,9 @@
         echo $value, PHP_EOL;
     }
 } catch (\Error $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-An iterator cannot be used with foreach by reference
+Error: An iterator cannot be used with foreach by reference
diff --git a/ext/spl/tests/SplArray_fromArray.phpt b/ext/spl/tests/SplArray_fromArray.phpt
index 143d2755a81..01d2875d272 100644
--- a/ext/spl/tests/SplArray_fromArray.phpt
+++ b/ext/spl/tests/SplArray_fromArray.phpt
@@ -10,8 +10,8 @@
 try {
   $splArray->fromArray($array);
 } catch (Exception $e) {
-  echo $e->getMessage();
+  echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-integer overflow detected
+InvalidArgumentException: integer overflow detected
diff --git a/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt b/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt
index 347450fbe4b..1c496aeffc0 100644
--- a/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt
@@ -6,8 +6,8 @@
     $dll = new SplDoublyLinkedList();
     var_dump($dll->add(12,'Offset 12 should not exist'));
 } catch (OutOfRangeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Exception: SplDoublyLinkedList::add(): Argument #1 ($index) is out of range
+OutOfRangeException: SplDoublyLinkedList::add(): Argument #1 ($index) is out of range
diff --git a/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt b/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt
index 1872436cea6..49326542818 100644
--- a/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt
@@ -6,8 +6,8 @@
     $dll = new SplDoublyLinkedList();
     var_dump($dll->add([],2));
 } catch (TypeError $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Exception: SplDoublyLinkedList::add(): Argument #1 ($index) must be of type int, array given
+TypeError: SplDoublyLinkedList::add(): Argument #1 ($index) must be of type int, array given
diff --git a/ext/spl/tests/SplDoublyLinkedList_bottom_empty.phpt b/ext/spl/tests/SplDoublyLinkedList_bottom_empty.phpt
index 65f0b3d404e..fd85e6aebea 100644
--- a/ext/spl/tests/SplDoublyLinkedList_bottom_empty.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_bottom_empty.phpt
@@ -7,8 +7,8 @@
 try {
     (new SplDoublyLinkedList)->bottom();
 } catch (RuntimeException $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-Can't peek at an empty datastructure
+RuntimeException: Can't peek at an empty datastructure
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_greater_than_elements.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_greater_than_elements.phpt
index 4fa65b3a53a..234628cd275 100644
--- a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_greater_than_elements.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_greater_than_elements.phpt
@@ -17,9 +17,9 @@
 var_dump($ll);

 } catch(Exception $e) {
-echo $e->getMessage();
+echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-SplDoublyLinkedList::offsetUnset(): Argument #1 ($index) is out of range
+OutOfRangeException: SplDoublyLinkedList::offsetUnset(): Argument #1 ($index) is out of range
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt
index 614ebdf01bb..f378de684b1 100644
--- a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt
@@ -16,8 +16,8 @@
         $dll->offsetUnset(-1);
     }
     catch (Exception $e) {
-        echo $e->getMessage() . "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 ?>
 --EXPECT--
-SplDoublyLinkedList::offsetUnset(): Argument #1 ($index) is out of range
+OutOfRangeException: SplDoublyLinkedList::offsetUnset(): Argument #1 ($index) is out of range
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt
index 6782bd94898..894f8076637 100644
--- a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt
@@ -16,8 +16,8 @@
         $dll->offsetUnset(3);
     }
     catch (Exception $e) {
-        echo $e->getMessage() . "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 ?>
 --EXPECT--
-SplDoublyLinkedList::offsetUnset(): Argument #1 ($index) is out of range
+OutOfRangeException: SplDoublyLinkedList::offsetUnset(): Argument #1 ($index) is out of range
diff --git a/ext/spl/tests/SplDoublyLinkedList_top_empty.phpt b/ext/spl/tests/SplDoublyLinkedList_top_empty.phpt
index 644e54bb9a1..ddcd20b2351 100644
--- a/ext/spl/tests/SplDoublyLinkedList_top_empty.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_top_empty.phpt
@@ -7,8 +7,8 @@
 try {
     (new SplDoublyLinkedList)->top();
 } catch (RuntimeException $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-Can't peek at an empty datastructure
+RuntimeException: Can't peek at an empty datastructure
diff --git a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt
index 4ace511e26b..96d4e5eddef 100644
--- a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt
+++ b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt
@@ -8,9 +8,9 @@
 try {
     $info->setFileClass('stdClass');
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-SplFileInfo::setFileClass(): Argument #1 ($class) must be a class name derived from SplFileObject, stdClass given
+TypeError: SplFileInfo::setFileClass(): Argument #1 ($class) must be a class name derived from SplFileObject, stdClass given
diff --git a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt
index 1f64c353d32..10b568bc027 100644
--- a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt
+++ b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt
@@ -8,9 +8,9 @@
 try {
     $info->setInfoClass('stdClass');
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-SplFileInfo::setInfoClass(): Argument #1 ($class) must be a class name derived from SplFileInfo, stdClass given
+TypeError: SplFileInfo::setInfoClass(): Argument #1 ($class) must be a class name derived from SplFileInfo, stdClass given
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_delimiter_error.phpt b/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_delimiter_error.phpt
index 7bfd61bbc18..99ce5203edf 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_delimiter_error.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_delimiter_error.phpt
@@ -20,7 +20,7 @@
 try {
     var_dump($fo->fgetcsv('invalid'));
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --CLEAN--
@@ -28,4 +28,4 @@
 unlink('SplFileObject__fgetcsv3.csv');
 ?>
 --EXPECT--
-SplFileObject::fgetcsv(): Argument #1 ($separator) must be a single character
+ValueError: SplFileObject::fgetcsv(): Argument #1 ($separator) must be a single character
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_enclosure_error.phpt b/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_enclosure_error.phpt
index 8ad609efab1..a13ac8d62a5 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_enclosure_error.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_enclosure_error.phpt
@@ -20,7 +20,7 @@
 try {
     var_dump($fo->fgetcsv(enclosure: 'invalid'));
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --CLEAN--
@@ -28,4 +28,4 @@
 unlink('SplFileObject__fgetcsv5.csv');
 ?>
 --EXPECT--
-SplFileObject::fgetcsv(): Argument #2 ($enclosure) must be a single character
+ValueError: SplFileObject::fgetcsv(): Argument #2 ($enclosure) must be a single character
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_escape_error.phpt b/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_escape_error.phpt
index eb6fc491611..d2421e23271 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_escape_error.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_escape_error.phpt
@@ -10,7 +10,7 @@
 try {
     var_dump($fo->fgetcsv(',', '"', 'invalid'));
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --CLEAN--
@@ -18,4 +18,4 @@
 unlink('SplFileObject__fgetcsv8.csv');
 ?>
 --EXPECT--
-SplFileObject::fgetcsv(): Argument #3 ($escape) must be empty or a single character
+ValueError: SplFileObject::fgetcsv(): Argument #3 ($escape) must be empty or a single character
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_fputcsv_variation13.phpt b/ext/spl/tests/SplFileObject/SplFileObject_fputcsv_variation13.phpt
index b2137999426..136491f915e 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_fputcsv_variation13.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_fputcsv_variation13.phpt
@@ -13,7 +13,7 @@
 try {
     var_dump($fo->fputcsv(array('water', 'fruit'), ',,', '"'));
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 unset($fo);
@@ -27,5 +27,5 @@
 ?>
 --EXPECT--
 *** Testing fputcsv() : with default enclosure & delimiter of two chars ***
-SplFileObject::fputcsv(): Argument #2 ($separator) must be a single character
+ValueError: SplFileObject::fputcsv(): Argument #2 ($separator) must be a single character
 Done
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_fputcsv_variation14.phpt b/ext/spl/tests/SplFileObject/SplFileObject_fputcsv_variation14.phpt
index c660d217acb..8a8cb968b0a 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_fputcsv_variation14.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_fputcsv_variation14.phpt
@@ -13,12 +13,12 @@
 try {
     var_dump($fo->fputcsv(array('water', 'fruit'), ',,', '""'));
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($fo->fputcsv(array('water', 'fruit'), ',', '""'));
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 unset($fo);
@@ -32,6 +32,6 @@
 ?>
 --EXPECT--
 *** Testing fputcsv() : with enclosure & delimiter of two chars and file opened in read mode ***
-SplFileObject::fputcsv(): Argument #2 ($separator) must be a single character
-SplFileObject::fputcsv(): Argument #3 ($enclosure) must be a single character
+ValueError: SplFileObject::fputcsv(): Argument #2 ($separator) must be a single character
+ValueError: SplFileObject::fputcsv(): Argument #3 ($enclosure) must be a single character
 Done
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_ftruncate_error_001.phpt b/ext/spl/tests/SplFileObject/SplFileObject_ftruncate_error_001.phpt
index a77257cc575..4fae0a83b23 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_ftruncate_error_001.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_ftruncate_error_001.phpt
@@ -26,8 +26,8 @@ function url_stat() {
 try {
     $obj->ftruncate(1);
 } catch (LogicException $e) {
-    echo($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-Can't truncate file %s
+LogicException: Can't truncate file %s
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_getCurrentLine_invalid_override.phpt b/ext/spl/tests/SplFileObject/SplFileObject_getCurrentLine_invalid_override.phpt
index 3501816366f..ee9930b7c8e 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_getCurrentLine_invalid_override.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_getCurrentLine_invalid_override.phpt
@@ -14,9 +14,9 @@ public function getCurrentLine(): array {
 try {
     var_dump($obj->current());
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-MySplFileObject::getCurrentLine(): Return value must be of type string, array returned
+TypeError: MySplFileObject::getCurrentLine(): Return value must be of type string, array returned
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_seek_error_001.phpt b/ext/spl/tests/SplFileObject/SplFileObject_seek_error_001.phpt
index d29e86b955d..a590f49a5f2 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_seek_error_001.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_seek_error_001.phpt
@@ -6,8 +6,8 @@
 try {
     $obj->seek(-1);
 } catch (\ValueError $e) {
-    echo($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-SplFileObject::seek(): Argument #1 ($line) must be greater than or equal to 0
+ValueError: SplFileObject::seek(): Argument #1 ($line) must be greater than or equal to 0
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error001.phpt b/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error001.phpt
index a2fea52d5a0..3ff6478ca1d 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error001.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error001.phpt
@@ -16,7 +16,7 @@
 try {
     $s->setCsvControl('||');
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --CLEAN--
@@ -24,4 +24,4 @@
 unlink('csv_control_data_error001.csv');
 ?>
 --EXPECT--
-SplFileObject::setCsvControl(): Argument #1 ($separator) must be a single character
+ValueError: SplFileObject::setCsvControl(): Argument #1 ($separator) must be a single character
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error002.phpt b/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error002.phpt
index 3e4c206fe0a..3a33c479fa0 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error002.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error002.phpt
@@ -16,7 +16,7 @@
 try {
     $s->setCsvControl('|', 'two');
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --CLEAN--
@@ -24,4 +24,4 @@
 unlink('csv_control_data_error002.csv');
 ?>
 --EXPECT--
-SplFileObject::setCsvControl(): Argument #2 ($enclosure) must be a single character
+ValueError: SplFileObject::setCsvControl(): Argument #2 ($enclosure) must be a single character
diff --git a/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error003.phpt b/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error003.phpt
index 35934f5e5cb..a68d0ad2978 100644
--- a/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error003.phpt
+++ b/ext/spl/tests/SplFileObject/SplFileObject_setCsvControl_error003.phpt
@@ -18,7 +18,7 @@
 try {
     $s->setCsvControl('|', '\'', 'three');
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --CLEAN--
@@ -26,4 +26,4 @@
 unlink('csv_control_data_error003.csv');
 ?>
 --EXPECT--
-SplFileObject::setCsvControl(): Argument #3 ($escape) must be empty or a single character
+ValueError: SplFileObject::setCsvControl(): Argument #3 ($escape) must be empty or a single character
diff --git a/ext/spl/tests/SplFileObject/bug54292.phpt b/ext/spl/tests/SplFileObject/bug54292.phpt
index 39bfb6f4dd6..53e8eedc8c1 100644
--- a/ext/spl/tests/SplFileObject/bug54292.phpt
+++ b/ext/spl/tests/SplFileObject/bug54292.phpt
@@ -6,9 +6,9 @@
 try {
     new SplFileObject('foo', array());
 } catch (TypeError $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-string(85) "SplFileObject::__construct(): Argument #2 ($mode) must be of type string, array given"
+TypeError: SplFileObject::__construct(): Argument #2 ($mode) must be of type string, array given
diff --git a/ext/spl/tests/SplFileObject/bug65545.phpt b/ext/spl/tests/SplFileObject/bug65545.phpt
index 8ebbf648c97..afac7c0f268 100644
--- a/ext/spl/tests/SplFileObject/bug65545.phpt
+++ b/ext/spl/tests/SplFileObject/bug65545.phpt
@@ -10,7 +10,7 @@
     $data = $obj->fread(0);
     var_dump($data);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 // read more data than is available
@@ -20,5 +20,5 @@
 ?>
 --EXPECT--
 string(5) "<?php"
-SplFileObject::fread(): Argument #1 ($length) must be greater than 0
+ValueError: SplFileObject::fread(): Argument #1 ($length) must be greater than 0
 bool(true)
diff --git a/ext/spl/tests/SplFileObject/fileobject_003.phpt b/ext/spl/tests/SplFileObject/fileobject_003.phpt
index 9758ec76341..f3a2aed75b8 100644
--- a/ext/spl/tests/SplFileObject/fileobject_003.phpt
+++ b/ext/spl/tests/SplFileObject/fileobject_003.phpt
@@ -31,13 +31,13 @@ function test($name, $lc, $lp)
         $l = substr($f->getPath(), -1);
         var_dump($l != '/' && $l != '\\' && $l == $lp);
     } catch (LogicException $e) {
-        echo "LogicException: ".$e->getMessage()."\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     try {
         $fo = $o->openFile();
         var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath());
     } catch (LogicException $e) {
-        echo "LogicException: ".$e->getMessage()."\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }

diff --git a/ext/spl/tests/SplFileObject/fileobject_setmaxlinelen_error001.phpt b/ext/spl/tests/SplFileObject/fileobject_setmaxlinelen_error001.phpt
index 018ecd47b42..ea64231d04c 100644
--- a/ext/spl/tests/SplFileObject/fileobject_setmaxlinelen_error001.phpt
+++ b/ext/spl/tests/SplFileObject/fileobject_setmaxlinelen_error001.phpt
@@ -9,9 +9,9 @@
     $s->setMaxLineLen(-1);
 }
 catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-SplFileObject::setMaxLineLen(): Argument #1 ($maxLength) must be greater than or equal to 0
+ValueError: SplFileObject::setMaxLineLen(): Argument #1 ($maxLength) must be greater than or equal to 0
diff --git a/ext/spl/tests/SplFixedArray__construct_param_array.phpt b/ext/spl/tests/SplFixedArray__construct_param_array.phpt
index 76f32855b2a..5fa62c86a54 100644
--- a/ext/spl/tests/SplFixedArray__construct_param_array.phpt
+++ b/ext/spl/tests/SplFixedArray__construct_param_array.phpt
@@ -8,9 +8,9 @@
 try {
     $array = new SplFixedArray( array("string", 1) );
 } catch (TypeError $iae) {
-    echo "Ok - ".$iae->getMessage().PHP_EOL;
+    echo $iae::class, ': ', $iae->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Ok - SplFixedArray::__construct(): Argument #1 ($size) must be of type int, array given
+TypeError: SplFixedArray::__construct(): Argument #1 ($size) must be of type int, array given
diff --git a/ext/spl/tests/SplFixedArray__construct_param_string.phpt b/ext/spl/tests/SplFixedArray__construct_param_string.phpt
index 1c9a681e82a..d9a49092287 100644
--- a/ext/spl/tests/SplFixedArray__construct_param_string.phpt
+++ b/ext/spl/tests/SplFixedArray__construct_param_string.phpt
@@ -7,10 +7,10 @@
 try {
     $array = new SplFixedArray( "string" );
 } catch (TypeError $iae) {
-    echo "Ok - ".$iae->getMessage().PHP_EOL;
+    echo $iae::class, ': ', $iae->getMessage(), PHP_EOL;
 }


 ?>
 --EXPECT--
-Ok - SplFixedArray::__construct(): Argument #1 ($size) must be of type int, string given
+TypeError: SplFixedArray::__construct(): Argument #1 ($size) must be of type int, string given
diff --git a/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt
index ab9b430d2a7..0d2723c60e6 100644
--- a/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt
+++ b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt
@@ -7,9 +7,9 @@
 try {
     $array = new SplFixedArray(new SplFixedArray(3));
 } catch (TypeError $iae) {
-    echo "Ok - ".$iae->getMessage().PHP_EOL;
+    echo $iae::class, ': ', $iae->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Ok - SplFixedArray::__construct(): Argument #1 ($size) must be of type int, SplFixedArray given
+TypeError: SplFixedArray::__construct(): Argument #1 ($size) must be of type int, SplFixedArray given
diff --git a/ext/spl/tests/SplHeap_serialize_corrupted.phpt b/ext/spl/tests/SplHeap_serialize_corrupted.phpt
index 8763a4c0829..4abf239d04c 100644
--- a/ext/spl/tests/SplHeap_serialize_corrupted.phpt
+++ b/ext/spl/tests/SplHeap_serialize_corrupted.phpt
@@ -28,7 +28,7 @@ public function compare($a, $b): int {
     serialize($heap);
     echo "FAIL: Serialization should have thrown\n";
 } catch (Exception $e) {
-    echo "Serialization failed: " . $e->getMessage() . "\n";
+    echo 'Serialization failed: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 class ThrowingPQ extends SplPriorityQueue {
@@ -56,12 +56,12 @@ public function compare($priority1, $priority2): int {
     serialize($pq);
     echo "FAIL: PQ Serialization should have thrown\n";
 } catch (Exception $e) {
-    echo "PQ Serialization failed: " . $e->getMessage() . "\n";
+    echo 'PQ Serialization failed: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
 Heap is corrupted: YES
-Serialization failed: Heap is corrupted, heap properties are no longer ensured.
+Serialization failed: RuntimeException: Heap is corrupted, heap properties are no longer ensured.
 PriorityQueue is corrupted: YES
-PQ Serialization failed: Heap is corrupted, heap properties are no longer ensured.
+PQ Serialization failed: RuntimeException: Heap is corrupted, heap properties are no longer ensured.
diff --git a/ext/spl/tests/SplHeap_serialize_error_handling.phpt b/ext/spl/tests/SplHeap_serialize_error_handling.phpt
index 458f27db5ce..bbcbe48515f 100644
--- a/ext/spl/tests/SplHeap_serialize_error_handling.phpt
+++ b/ext/spl/tests/SplHeap_serialize_error_handling.phpt
@@ -37,7 +37,7 @@
         $heap->__unserialize($case);
         echo "Case $i: UNEXPECTED SUCCESS\n";
     } catch (Exception $e) {
-        echo "Case $i: " . $e->getMessage() . "\n";
+        echo "Case $i: ", $e::class, ': ', $e->getMessage(), "\n";
     }
 }

@@ -60,25 +60,25 @@
         $pq->__unserialize($case);
         echo "PQ Case $i: UNEXPECTED SUCCESS\n";
     } catch (Exception $e) {
-        echo "PQ Case $i: " . $e->getMessage() . "\n";
+        echo "PQ Case $i: ", $e::class, ': ', $e->getMessage(), "\n";
     }
 }

 ?>
 --EXPECT--
-Case 0: Invalid serialization data for SplMaxHeap object
-Case 1: Invalid serialization data for SplMaxHeap object
-Case 2: Invalid serialization data for SplMaxHeap object
-Case 3: Invalid serialization data for SplMaxHeap object
-Case 4: Invalid serialization data for SplMaxHeap object
-Case 5: Invalid serialization data for SplMaxHeap object
-Case 6: Invalid serialization data for SplMaxHeap object
-Case 7: Invalid serialization data for SplMaxHeap object
-Case 8: Invalid serialization data for SplMaxHeap object
-Case 9: Invalid serialization data for SplMaxHeap object
-Case 10: Invalid serialization data for SplMaxHeap object
-PQ Case 0: Invalid serialization data for SplPriorityQueue object
-PQ Case 1: Invalid serialization data for SplPriorityQueue object
-PQ Case 2: Invalid serialization data for SplPriorityQueue object
-PQ Case 3: Invalid serialization data for SplPriorityQueue object
-PQ Case 4: Invalid serialization data for SplPriorityQueue object
+Case 0: Exception: Invalid serialization data for SplMaxHeap object
+Case 1: Exception: Invalid serialization data for SplMaxHeap object
+Case 2: Exception: Invalid serialization data for SplMaxHeap object
+Case 3: Exception: Invalid serialization data for SplMaxHeap object
+Case 4: Exception: Invalid serialization data for SplMaxHeap object
+Case 5: Exception: Invalid serialization data for SplMaxHeap object
+Case 6: Exception: Invalid serialization data for SplMaxHeap object
+Case 7: Exception: Invalid serialization data for SplMaxHeap object
+Case 8: Exception: Invalid serialization data for SplMaxHeap object
+Case 9: Exception: Invalid serialization data for SplMaxHeap object
+Case 10: Exception: Invalid serialization data for SplMaxHeap object
+PQ Case 0: Exception: Invalid serialization data for SplPriorityQueue object
+PQ Case 1: Exception: Invalid serialization data for SplPriorityQueue object
+PQ Case 2: Exception: Invalid serialization data for SplPriorityQueue object
+PQ Case 3: Exception: Invalid serialization data for SplPriorityQueue object
+PQ Case 4: Exception: Invalid serialization data for SplPriorityQueue object
diff --git a/ext/spl/tests/SplObjectStorage/SplObjectStorage_coalesce.phpt b/ext/spl/tests/SplObjectStorage/SplObjectStorage_coalesce.phpt
index d4075018d34..91d80b3d7de 100644
--- a/ext/spl/tests/SplObjectStorage/SplObjectStorage_coalesce.phpt
+++ b/ext/spl/tests/SplObjectStorage/SplObjectStorage_coalesce.phpt
@@ -96,4 +96,4 @@
       bool(false)
     }
   }
-}
\ No newline at end of file
+}
diff --git a/ext/spl/tests/SplObjectStorage/SplObjectStorage_current_empty_storage.phpt b/ext/spl/tests/SplObjectStorage/SplObjectStorage_current_empty_storage.phpt
index 096cd511128..fed9330c3fc 100644
--- a/ext/spl/tests/SplObjectStorage/SplObjectStorage_current_empty_storage.phpt
+++ b/ext/spl/tests/SplObjectStorage/SplObjectStorage_current_empty_storage.phpt
@@ -11,10 +11,10 @@
 try {
     var_dump($s->current());
 } catch (RuntimeException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
 bool(false)
-Called current() on invalid iterator
+RuntimeException: Called current() on invalid iterator
diff --git a/ext/spl/tests/SplObjectStorage/SplObjectStorage_offsetGet_missing_object.phpt b/ext/spl/tests/SplObjectStorage/SplObjectStorage_offsetGet_missing_object.phpt
index 54fcc23d4dc..772d8a09e30 100644
--- a/ext/spl/tests/SplObjectStorage/SplObjectStorage_offsetGet_missing_object.phpt
+++ b/ext/spl/tests/SplObjectStorage/SplObjectStorage_offsetGet_missing_object.phpt
@@ -11,9 +11,9 @@
 try {
     $s->offsetGet($o1);
 } catch (UnexpectedValueException $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Object not found
+UnexpectedValueException: Object not found
diff --git a/ext/spl/tests/SplObjectStorage/SplObjectStorage_seek.phpt b/ext/spl/tests/SplObjectStorage/SplObjectStorage_seek.phpt
index ce21b2a621f..cc0b9d3ce0c 100644
--- a/ext/spl/tests/SplObjectStorage/SplObjectStorage_seek.phpt
+++ b/ext/spl/tests/SplObjectStorage/SplObjectStorage_seek.phpt
@@ -25,12 +25,12 @@ public function __construct(public string $marker) {}
 try {
     $storage->seek(-1);
 } catch (OutOfBoundsException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $storage->seek(5);
 } catch (OutOfBoundsException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump($storage->key());
@@ -76,14 +76,14 @@ public function __construct(public string $marker) {}
 try {
     $storage->seek(3);
 } catch (OutOfBoundsException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
 --- Error cases ---
-Seek position -1 is out of range
-Seek position 5 is out of range
+OutOfBoundsException: Seek position -1 is out of range
+OutOfBoundsException: Seek position 5 is out of range
 int(0)
 object(Test)#1 (1) {
   ["marker"]=>
@@ -136,4 +136,4 @@ public function __construct(public string $marker) {}
   ["marker"]=>
   string(1) "e"
 }
-Seek position 3 is out of range
+OutOfBoundsException: Seek position 3 is out of range
diff --git a/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_bad.phpt b/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_bad.phpt
index b2fbf264286..03ad16f57fd 100644
--- a/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_bad.phpt
+++ b/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_bad.phpt
@@ -15,14 +15,14 @@
   $so->unserialize($blob);
   var_dump($so);
 } catch(UnexpectedValueException $e) {
-    echo $e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 }
 echo "DONE\n";
 ?>
 --EXPECT--
-Error at offset 6 of 34 bytes
-Error at offset 46 of 89 bytes
+UnexpectedValueException: Error at offset 6 of 34 bytes
+UnexpectedValueException: Error at offset 46 of 89 bytes
 object(SplObjectStorage)#2 (1) {
   ["storage":"SplObjectStorage":private]=>
   array(2) {
@@ -45,5 +45,5 @@
     }
   }
 }
-Error at offset 78 of 78 bytes
+UnexpectedValueException: Error at offset 78 of 78 bytes
 DONE
diff --git a/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_invalid_parameter2.phpt b/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_invalid_parameter2.phpt
index 0ff158c85c5..9d1afe16ef2 100644
--- a/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_invalid_parameter2.phpt
+++ b/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_invalid_parameter2.phpt
@@ -20,14 +20,14 @@
     try {
         $s->unserialize($input);
     } catch(UnexpectedValueException $e) {
-        echo $e->getMessage() . PHP_EOL;
+        echo $e::class, ': ', $e->getMessage(), PHP_EOL;
     }
 }

 ?>
 --EXPECTF--
-Error at offset %d of %d bytes
-Error at offset %d of %d bytes
-Error at offset %d of %d bytes
-Error at offset %d of %d bytes
-Error at offset %d of %d bytes
+UnexpectedValueException: Error at offset %d of %d bytes
+UnexpectedValueException: Error at offset %d of %d bytes
+UnexpectedValueException: Error at offset %d of %d bytes
+UnexpectedValueException: Error at offset %d of %d bytes
+UnexpectedValueException: Error at offset %d of %d bytes
diff --git a/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_invalid_parameter3.phpt b/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_invalid_parameter3.phpt
index 6934c3af1bf..a82242dfb45 100644
--- a/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_invalid_parameter3.phpt
+++ b/ext/spl/tests/SplObjectStorage/SplObjectStorage_unserialize_invalid_parameter3.phpt
@@ -10,7 +10,7 @@
 try {
     $s->unserialize('');
 } catch(UnexpectedValueException $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
diff --git a/ext/spl/tests/SplObjectStorage/SplObjectStorage_unset.phpt b/ext/spl/tests/SplObjectStorage/SplObjectStorage_unset.phpt
index 2e3e58c837c..3c69760642b 100644
--- a/ext/spl/tests/SplObjectStorage/SplObjectStorage_unset.phpt
+++ b/ext/spl/tests/SplObjectStorage/SplObjectStorage_unset.phpt
@@ -16,14 +16,14 @@ public function __destruct() {
 try {
     unset($s[$o]);
 } catch (Exception $e) {
-    echo "Caught: {$e->getMessage()}\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($s);
 $s[$o] = new HasDestructor();
 try {
     $s->offsetUnset($o);
 } catch (Exception $e) {
-    echo "Caught: {$e->getMessage()}\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump($s);
@@ -35,7 +35,7 @@ public function __destruct() {
   array(0) {
   }
 }
-Caught: thrown from destructor
+RuntimeException: thrown from destructor
 object(SplObjectStorage)#2 (1) {
   ["storage":"SplObjectStorage":private]=>
   array(0) {
@@ -47,9 +47,9 @@ public function __destruct() {
   array(0) {
   }
 }
-Caught: thrown from destructor
+RuntimeException: thrown from destructor
 object(SplObjectStorage)#2 (1) {
   ["storage":"SplObjectStorage":private]=>
   array(0) {
   }
-}
\ No newline at end of file
+}
diff --git a/ext/spl/tests/SplObjectStorage/concurrent_deletion.phpt b/ext/spl/tests/SplObjectStorage/concurrent_deletion.phpt
index 9da6270b6d7..a4b4e7d3a98 100644
--- a/ext/spl/tests/SplObjectStorage/concurrent_deletion.phpt
+++ b/ext/spl/tests/SplObjectStorage/concurrent_deletion.phpt
@@ -33,7 +33,7 @@ function populate(SplObjectStorage $victim, SplObjectStorage $other): void {
 try {
     $victim->removeAllExcept($other);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(count($victim), count($other));
@@ -48,15 +48,15 @@ function populate(SplObjectStorage $victim, SplObjectStorage $other): void {
 try {
     $other->addAll($victim);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(count($victim), count($other));
 ?>
 --EXPECT--
-Modification of SplObjectStorage during getHash() is prohibited
+Error: Modification of SplObjectStorage during getHash() is prohibited
 int(1024)
 int(1024)
-Modification of SplObjectStorage during getHash() is prohibited
+Error: Modification of SplObjectStorage during getHash() is prohibited
 int(1024)
 int(1024)
diff --git a/ext/spl/tests/SplObjectStorage/concurrent_deletion_addall.phpt b/ext/spl/tests/SplObjectStorage/concurrent_deletion_addall.phpt
index aadbe2acba2..6c940869915 100644
--- a/ext/spl/tests/SplObjectStorage/concurrent_deletion_addall.phpt
+++ b/ext/spl/tests/SplObjectStorage/concurrent_deletion_addall.phpt
@@ -20,13 +20,13 @@ public function getHash($obj): string {
 try {
     $evil->addAll($storage);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(count($evil), count($storage));

 ?>
 --EXPECT--
-Modification of SplObjectStorage during getHash() is prohibited
+Error: Modification of SplObjectStorage during getHash() is prohibited
 int(0)
 int(1)
diff --git a/ext/spl/tests/SplObjectStorage/concurrent_deletion_removeexcept.phpt b/ext/spl/tests/SplObjectStorage/concurrent_deletion_removeexcept.phpt
index 2602bc9e1f0..27bf06c347c 100644
--- a/ext/spl/tests/SplObjectStorage/concurrent_deletion_removeexcept.phpt
+++ b/ext/spl/tests/SplObjectStorage/concurrent_deletion_removeexcept.phpt
@@ -20,13 +20,13 @@ public function getHash($obj): string {
 try {
     $storage->removeAllExcept($evil);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(count($evil), count($storage));

 ?>
 --EXPECT--
-Modification of SplObjectStorage during getHash() is prohibited
+Error: Modification of SplObjectStorage during getHash() is prohibited
 int(0)
 int(1)
diff --git a/ext/spl/tests/SplObjectStorage/gh21831.phpt b/ext/spl/tests/SplObjectStorage/gh21831.phpt
index 581012d86a4..2eb51444559 100644
--- a/ext/spl/tests/SplObjectStorage/gh21831.phpt
+++ b/ext/spl/tests/SplObjectStorage/gh21831.phpt
@@ -25,12 +25,12 @@ public function getHash($obj): string {
 try {
     $storage->removeAllExcept($filter);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(count($storage));

 ?>
 --EXPECT--
-Modification of SplObjectStorage during getHash() is prohibited
+Error: Modification of SplObjectStorage during getHash() is prohibited
 int(1)
diff --git a/ext/spl/tests/SplPriorityQueue_unserialize_invalid_flags.phpt b/ext/spl/tests/SplPriorityQueue_unserialize_invalid_flags.phpt
index 8c785606c7f..916c32edae0 100644
--- a/ext/spl/tests/SplPriorityQueue_unserialize_invalid_flags.phpt
+++ b/ext/spl/tests/SplPriorityQueue_unserialize_invalid_flags.phpt
@@ -16,7 +16,7 @@
     $queue->__unserialize($data);
     echo "Should have thrown exception for invalid flags\n";
 } catch (Exception $e) {
-    echo "Exception thrown for invalid flags: " . $e->getMessage() . "\n";
+    echo 'invalid flags: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
@@ -32,7 +32,7 @@
     $queue->__unserialize($data);
     echo "Should have thrown exception for zero flags\n";
 } catch (Exception $e) {
-    echo "Exception thrown for zero flags: " . $e->getMessage() . "\n";
+    echo 'zero flags: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
@@ -48,7 +48,7 @@
     $queue->__unserialize($data);
     echo "Valid flags accepted\n";
 } catch (Exception $e) {
-    echo "Valid flags rejected: " . $e->getMessage() . "\n";
+    echo 'Valid flags rejected: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
@@ -69,12 +69,12 @@
         echo "Flags not properly masked, got: " . $queue->getExtractFlags() . "\n";
     }
 } catch (Exception $e) {
-    echo "Flags with extra bits should be masked: " . $e->getMessage() . "\n";
+    echo 'Flags with extra bits should be masked: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Exception thrown for invalid flags: Invalid serialization data for SplPriorityQueue object
-Exception thrown for zero flags: Invalid serialization data for SplPriorityQueue object
+invalid flags: Exception: Invalid serialization data for SplPriorityQueue object
+zero flags: Exception: Invalid serialization data for SplPriorityQueue object
 Valid flags accepted
 Flags properly masked
diff --git a/ext/spl/tests/SplQueue_setIteratorMode.phpt b/ext/spl/tests/SplQueue_setIteratorMode.phpt
index 5ad1d9258a7..0e291b35543 100644
--- a/ext/spl/tests/SplQueue_setIteratorMode.phpt
+++ b/ext/spl/tests/SplQueue_setIteratorMode.phpt
@@ -8,8 +8,8 @@
 try {
   $queue->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
 } catch (Exception $e) {
-  echo $e->getMessage();
+  echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
+RuntimeException: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
diff --git a/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt b/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt
index 255f0cd2e4d..3d58d09a75f 100644
--- a/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt
+++ b/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt
@@ -11,9 +11,9 @@
     $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);

 } catch (Exception $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
+RuntimeException: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
diff --git a/ext/spl/tests/SplStack_setIteratorMode.phpt b/ext/spl/tests/SplStack_setIteratorMode.phpt
index 342a6b8bb24..e059a35cfca 100644
--- a/ext/spl/tests/SplStack_setIteratorMode.phpt
+++ b/ext/spl/tests/SplStack_setIteratorMode.phpt
@@ -8,8 +8,8 @@
 try {
   $stack->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
 } catch (Exception $e) {
-  echo $e->getMessage();
+  echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
+RuntimeException: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
diff --git a/ext/spl/tests/SplTempFileObject_constructor_error.phpt b/ext/spl/tests/SplTempFileObject_constructor_error.phpt
index 212a4df2ff8..de520b1922f 100644
--- a/ext/spl/tests/SplTempFileObject_constructor_error.phpt
+++ b/ext/spl/tests/SplTempFileObject_constructor_error.phpt
@@ -5,8 +5,8 @@
 try {
     new SplTempFileObject('invalid');
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-SplTempFileObject::__construct(): Argument #1 ($maxMemory) must be of type int, string given
+TypeError: SplTempFileObject::__construct(): Argument #1 ($maxMemory) must be of type int, string given
diff --git a/ext/spl/tests/autoloading/bug73896.phpt b/ext/spl/tests/autoloading/bug73896.phpt
index 657f30c50db..c31d3285803 100644
--- a/ext/spl/tests/autoloading/bug73896.phpt
+++ b/ext/spl/tests/autoloading/bug73896.phpt
@@ -31,8 +31,8 @@ public function doSomething() {
 try {
     new teChild();
 } catch (Throwable $e) {
-    echo "Exception: ", $e->getMessage() , "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Exception: Class "teException" not found
+Error: Class "teException" not found
diff --git a/ext/spl/tests/autoloading/spl_autoload_001.phpt b/ext/spl/tests/autoloading/spl_autoload_001.phpt
index befb9657095..761699bd8e7 100644
--- a/ext/spl/tests/autoloading/spl_autoload_001.phpt
+++ b/ext/spl/tests/autoloading/spl_autoload_001.phpt
@@ -67,7 +67,7 @@ function TestFunc2($classname)
 try {
     spl_autoload_register("unavailable_autoload_function");
 } catch(\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
@@ -100,4 +100,4 @@ function TestFunc2($classname)
 %stestclass.class.inc
 bool(true)
 ===NOFUNCTION===
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, function "unavailable_autoload_function" not found or invalid function name
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, function "unavailable_autoload_function" not found or invalid function name
diff --git a/ext/spl/tests/autoloading/spl_autoload_003.phpt b/ext/spl/tests/autoloading/spl_autoload_003.phpt
index 016bcf2394b..7485ea88ece 100644
--- a/ext/spl/tests/autoloading/spl_autoload_003.phpt
+++ b/ext/spl/tests/autoloading/spl_autoload_003.phpt
@@ -31,7 +31,7 @@ function TestFunc3($classname)
 }
 catch(Exception $e)
 {
-    echo 'Exception: ' . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
diff --git a/ext/spl/tests/autoloading/spl_autoload_005.phpt b/ext/spl/tests/autoloading/spl_autoload_005.phpt
index 0f2c5ed2c30..a3f2bc3c4b9 100644
--- a/ext/spl/tests/autoloading/spl_autoload_005.phpt
+++ b/ext/spl/tests/autoloading/spl_autoload_005.phpt
@@ -22,7 +22,7 @@ function autoThrow($className)
 try {
     spl_autoload_register(array('MyAutoLoader', 'autoLoad'), true);
 } catch(\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 // and
@@ -38,12 +38,12 @@ function autoThrow($className)
 }
 catch(Exception $e)
 {
-    echo 'Exception: ' . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::autoLoad() cannot be called statically
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::autoLoad() cannot be called statically
 MyAutoLoader::autoLoad(TestClass)
 MyAutoLoader::autoThrow(TestClass)
 Exception: Unavailable
diff --git a/ext/spl/tests/autoloading/spl_autoload_007.phpt b/ext/spl/tests/autoloading/spl_autoload_007.phpt
index 0a8183dfb40..c47b10c270c 100644
--- a/ext/spl/tests/autoloading/spl_autoload_007.phpt
+++ b/ext/spl/tests/autoloading/spl_autoload_007.phpt
@@ -45,23 +45,23 @@ function dynaLoad($className) {
         spl_autoload_register($func);
         echo "ok\n";
     } catch(\TypeError $e) {
-        echo $e->getMessage() . \PHP_EOL;
+        echo $e::class, ': ', $e->getMessage(), PHP_EOL;
     }
 }

 ?>
 --EXPECTF--
 string(22) "MyAutoLoader::notExist"
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, class MyAutoLoader does not have a method "notExist"
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, class MyAutoLoader does not have a method "notExist"

 string(22) "MyAutoLoader::noAccess"
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method MyAutoLoader::noAccess()
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method MyAutoLoader::noAccess()

 string(22) "MyAutoLoader::autoLoad"
 ok

 string(22) "MyAutoLoader::dynaLoad"
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::dynaLoad() cannot be called statically
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::dynaLoad() cannot be called statically

 array(2) {
   [0]=>
@@ -69,7 +69,7 @@ function dynaLoad($className) {
   [1]=>
   string(8) "notExist"
 }
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, class MyAutoLoader does not have a method "notExist"
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, class MyAutoLoader does not have a method "notExist"

 array(2) {
   [0]=>
@@ -77,7 +77,7 @@ function dynaLoad($className) {
   [1]=>
   string(8) "noAccess"
 }
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method MyAutoLoader::noAccess()
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method MyAutoLoader::noAccess()

 array(2) {
   [0]=>
@@ -93,7 +93,7 @@ function dynaLoad($className) {
   [1]=>
   string(8) "dynaLoad"
 }
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::dynaLoad() cannot be called statically
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::dynaLoad() cannot be called statically

 array(2) {
   [0]=>
@@ -102,7 +102,7 @@ function dynaLoad($className) {
   [1]=>
   string(8) "notExist"
 }
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, class MyAutoLoader does not have a method "notExist"
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, class MyAutoLoader does not have a method "notExist"

 array(2) {
   [0]=>
@@ -111,7 +111,7 @@ function dynaLoad($className) {
   [1]=>
   string(8) "noAccess"
 }
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method MyAutoLoader::noAccess()
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method MyAutoLoader::noAccess()

 array(2) {
   [0]=>
diff --git a/ext/spl/tests/autoloading/spl_autoload_008.phpt b/ext/spl/tests/autoloading/spl_autoload_008.phpt
index 738c691ddfe..9a45409beb5 100644
--- a/ext/spl/tests/autoloading/spl_autoload_008.phpt
+++ b/ext/spl/tests/autoloading/spl_autoload_008.phpt
@@ -46,7 +46,7 @@ function dynaLoad($className)
     try {
         spl_autoload_register($func);
     } catch (TypeError $e) {
-        echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
+        echo $e::class, ': ', $e->getMessage(), PHP_EOL;
         var_dump(count(spl_autoload_functions()));
         continue;
     }
@@ -57,7 +57,7 @@ function dynaLoad($className)
         try {
             var_dump(class_exists("NoExistingTestClass", true));
         } catch (Exception $e) {
-            echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
+            echo $e::class, ': ', $e->getMessage(), PHP_EOL;
         }
     }

diff --git a/ext/spl/tests/autoloading/spl_autoload_012.phpt b/ext/spl/tests/autoloading/spl_autoload_012.phpt
index 218d3e800ff..a9da7cf8bbf 100644
--- a/ext/spl/tests/autoloading/spl_autoload_012.phpt
+++ b/ext/spl/tests/autoloading/spl_autoload_012.phpt
@@ -22,7 +22,7 @@ function autoload_second($name)
     class_exists('ThisClassDoesNotExist');
 } catch(Exception $e) {
     do {
-        echo $e->getMessage()."\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     } while($e = $e->getPrevious());
 }

@@ -30,7 +30,7 @@ class_exists('ThisClassDoesNotExist');
     new ThisClassDoesNotExist;
 } catch(Exception $e) {
     do {
-        echo $e->getMessage()."\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     } while($e = $e->getPrevious());
 }

@@ -39,9 +39,9 @@ class_exists('ThisClassDoesNotExist');
 ===DONE===
 --EXPECTF--
 autoload_first
-first
+Exception: first
 autoload_first
-first
+Exception: first
 autoload_first

 Fatal error: Uncaught Exception: first in %sspl_autoload_012.php:%d
diff --git a/ext/spl/tests/autoloading/spl_autoload_throw_with_spl_autoloader_call_as_autoloader.phpt b/ext/spl/tests/autoloading/spl_autoload_throw_with_spl_autoloader_call_as_autoloader.phpt
index 943d80ae253..48dd7120cfb 100644
--- a/ext/spl/tests/autoloading/spl_autoload_throw_with_spl_autoloader_call_as_autoloader.phpt
+++ b/ext/spl/tests/autoloading/spl_autoload_throw_with_spl_autoloader_call_as_autoloader.phpt
@@ -6,9 +6,9 @@
 try {
     spl_autoload_register('spl_autoload_call');
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-spl_autoload_register(): Argument #1 ($callback) must not be the spl_autoload_call() function
+ValueError: spl_autoload_register(): Argument #1 ($callback) must not be the spl_autoload_call() function
diff --git a/ext/spl/tests/bug31185.phpt b/ext/spl/tests/bug31185.phpt
index 70ae1c00983..a327b4d4de1 100644
--- a/ext/spl/tests/bug31185.phpt
+++ b/ext/spl/tests/bug31185.phpt
@@ -37,7 +37,7 @@ public function offsetUnset($index): void {
 }
 catch (Exception $e)
 {
-    echo "CAUGHT: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 print_R($foo);
@@ -46,7 +46,7 @@ public function offsetUnset($index): void {
 FooBar::offsetSet(0, 0)
 FooBar::offsetSet(1, 1)
 FooBar::offsetSet(2, 2)
-CAUGHT: FAIL
+Exception: FAIL
 FooBar Object
 (
     [array:FooBar:private] => Array
diff --git a/ext/spl/tests/bug37457.phpt b/ext/spl/tests/bug37457.phpt
index e8c7d7b9afc..c5ecd4567b6 100644
--- a/ext/spl/tests/bug37457.phpt
+++ b/ext/spl/tests/bug37457.phpt
@@ -64,7 +64,7 @@ public function accept(): bool
 }
 catch (Exception $e)
 {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -75,4 +75,4 @@ public function accept(): bool
 Collection::current
 Collection::key
 TestFilter::accept
-string(17) "Failure in Accept"
+Exception: Failure in Accept
diff --git a/ext/spl/tests/bug42703.phpt b/ext/spl/tests/bug42703.phpt
index d869fef0d58..5323b187c7d 100644
--- a/ext/spl/tests/bug42703.phpt
+++ b/ext/spl/tests/bug42703.phpt
@@ -29,13 +29,13 @@ public function key(): mixed { return null; }
   }
 }
 catch (Exception $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump($itit->current());
 var_dump($itit->key());
 ?>
 --EXPECT--
-string(3) "boo"
+Exception: boo
 NULL
 NULL
diff --git a/ext/spl/tests/bug51119.phpt b/ext/spl/tests/bug51119.phpt
index 2f3348a2c49..c484a6fa5fa 100644
--- a/ext/spl/tests/bug51119.phpt
+++ b/ext/spl/tests/bug51119.phpt
@@ -14,7 +14,7 @@
 try {
     $limitIterator = new LimitIterator($arrayIterator, -1);
 } catch (\ValueError $e){
-    print $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -22,4 +22,4 @@
 a
 b
 c
-LimitIterator::__construct(): Argument #2 ($offset) must be greater than or equal to 0
+ValueError: LimitIterator::__construct(): Argument #2 ($offset) must be greater than or equal to 0
diff --git a/ext/spl/tests/bug61828.phpt b/ext/spl/tests/bug61828.phpt
index 2a11b760bb3..a01f85c7b0d 100644
--- a/ext/spl/tests/bug61828.phpt
+++ b/ext/spl/tests/bug61828.phpt
@@ -7,9 +7,9 @@
 try {
     $x->__construct('/tmp');
 } catch (\Error $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Directory object is already initialized
+Error: Directory object is already initialized
diff --git a/ext/spl/tests/bug67539.phpt b/ext/spl/tests/bug67539.phpt
index 61f70cf459b..7149bd55a42 100644
--- a/ext/spl/tests/bug67539.phpt
+++ b/ext/spl/tests/bug67539.phpt
@@ -9,7 +9,7 @@ function badsort($a, $b) {
     try {
         $GLOBALS['it']->unserialize($GLOBALS['it']->serialize());
     } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     return 0;
 }
@@ -17,4 +17,4 @@ function badsort($a, $b) {
 $it->uksort('badsort');
 ?>
 --EXPECT--
-Modification of ArrayObject during sorting is prohibited
+Error: Modification of ArrayObject during sorting is prohibited
diff --git a/ext/spl/tests/bug70068.phpt b/ext/spl/tests/bug70068.phpt
index 54f3cca4496..adc38aff142 100644
--- a/ext/spl/tests/bug70068.phpt
+++ b/ext/spl/tests/bug70068.phpt
@@ -5,10 +5,10 @@
 try {
 $a = unserialize('a:3:{i:0;C:11:"ArrayObject":20:{x:i:0;r:3;;m:a:0:{};}i:1;d:11;i:2;S:31:"AAAAAAAABBBBCCCC\01\00\00\00\04\00\00\00\00\00\00\00\00\00\00";}');
 } catch(Exception $e) {
-    print $e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 OK
 --EXPECT--
-Error at offset 10 of 20 bytes
+UnexpectedValueException: Error at offset 10 of 20 bytes
 OK
diff --git a/ext/spl/tests/bug70561.phpt b/ext/spl/tests/bug70561.phpt
index c6c229ad89d..47b1d321374 100644
--- a/ext/spl/tests/bug70561.phpt
+++ b/ext/spl/tests/bug70561.phpt
@@ -14,10 +14,10 @@
 try {
     $di->seek($cnt+1);
 } catch (OutOfBoundsException $ex) {
-    echo $ex->getMessage() . PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }
 echo "Is valid? " . (int) $di->valid() . PHP_EOL;
 ?>
 --EXPECTF--
-Seek position %d is out of range
+OutOfBoundsException: Seek position %d is out of range
 Is valid? 0
diff --git a/ext/spl/tests/bug71735.phpt b/ext/spl/tests/bug71735.phpt
index 7063aaab5aa..7dd000421e0 100644
--- a/ext/spl/tests/bug71735.phpt
+++ b/ext/spl/tests/bug71735.phpt
@@ -6,8 +6,8 @@
 $var_1=new SplStack();
 $var_1->offsetSet(100,new DateTime('2000-01-01'));
 } catch(OutOfRangeException $e) {
-    print $e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-SplDoublyLinkedList::offsetSet(): Argument #1 ($index) is out of range
+OutOfRangeException: SplDoublyLinkedList::offsetSet(): Argument #1 ($index) is out of range
diff --git a/ext/spl/tests/bug72684.phpt b/ext/spl/tests/bug72684.phpt
index 06665efdaab..5962754f560 100644
--- a/ext/spl/tests/bug72684.phpt
+++ b/ext/spl/tests/bug72684.phpt
@@ -13,9 +13,9 @@ function createGenerator() { yield 1; }
 try {
     iterator_to_array($appendIterator);
 } catch (\Exception $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Cannot traverse an already closed generator
+Exception: Cannot traverse an already closed generator
diff --git a/ext/spl/tests/bug72888.phpt b/ext/spl/tests/bug72888.phpt
index 5ca99a40a51..93bdaa7c3c6 100644
--- a/ext/spl/tests/bug72888.phpt
+++ b/ext/spl/tests/bug72888.phpt
@@ -7,12 +7,12 @@
 try {
     $y=clone $x;
 } catch (Error $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($y);
 ?>
 --EXPECTF--
-string(60) "Trying to clone an uncloneable object of class SplFileObject"
+Error: Trying to clone an uncloneable object of class SplFileObject

 Warning: Undefined variable $y in %s on line %d
 NULL
diff --git a/ext/spl/tests/bug73029.phpt b/ext/spl/tests/bug73029.phpt
index 771e81d5c4d..cc174bd2cdf 100644
--- a/ext/spl/tests/bug73029.phpt
+++ b/ext/spl/tests/bug73029.phpt
@@ -7,19 +7,19 @@
 $m = unserialize($a);
 $x = $m[2];
 } catch(UnexpectedValueException $e) {
-    print $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
 $a = 'C:11:"ArrayObject":19:0x:i:0;r:2;;m:a:0:{}}';
 $m = unserialize($a);
 $x = $m[2];
 } catch(UnexpectedValueException $e) {
-    print $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 DONE
 --EXPECTF--
-Error at offset 10 of 19 bytes
+UnexpectedValueException: Error at offset 10 of 19 bytes

 Warning: unserialize(): Error at offset 22 of 43 bytes in %s on line %d

diff --git a/ext/spl/tests/bug73629.phpt b/ext/spl/tests/bug73629.phpt
index f66c319ca18..dd6d7891768 100644
--- a/ext/spl/tests/bug73629.phpt
+++ b/ext/spl/tests/bug73629.phpt
@@ -6,13 +6,13 @@
 try {
     $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
 } catch (Exception $e) {
-    echo 'unexpected exception: ' . $e->getMessage() . "\n";
+    echo 'unexpected: ', $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $q->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
 } catch (Exception $e) {
-    echo 'expected exception: ' . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
+RuntimeException: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
diff --git a/ext/spl/tests/bug79432.phpt b/ext/spl/tests/bug79432.phpt
index 1230340e991..c3c9a9cb35f 100644
--- a/ext/spl/tests/bug79432.phpt
+++ b/ext/spl/tests/bug79432.phpt
@@ -6,9 +6,9 @@
 try {
     spl_autoload_call([]);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-spl_autoload_call(): Argument #1 ($class) must be of type string, array given
+TypeError: spl_autoload_call(): Argument #1 ($class) must be of type string, array given
diff --git a/ext/spl/tests/bug79987.phpt b/ext/spl/tests/bug79987.phpt
index b6ea8e2a9c4..d729f1d10cf 100644
--- a/ext/spl/tests/bug79987.phpt
+++ b/ext/spl/tests/bug79987.phpt
@@ -13,26 +13,26 @@ public function __construct() {
 try {
     var_dump($x->getLinkTarget());
 } catch (Throwable $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($x->getFilename());
 } catch (Throwable $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($x->getExtension());
 } catch (Throwable $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($x->getBasename());
 } catch (Throwable $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Object not initialized
-Object not initialized
-Object not initialized
-Object not initialized
+Error: Object not initialized
+Error: Object not initialized
+Error: Object not initialized
+Error: Object not initialized
diff --git a/ext/spl/tests/bug80719.phpt b/ext/spl/tests/bug80719.phpt
index 506b250dae2..e0d7282fae3 100644
--- a/ext/spl/tests/bug80719.phpt
+++ b/ext/spl/tests/bug80719.phpt
@@ -7,7 +7,7 @@
 try {
     $array->setIteratorClass(FilterIterator::class);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 foreach ($array as $v) {
     var_dump($v);
@@ -15,5 +15,5 @@

 ?>
 --EXPECT--
-ArrayObject::setIteratorClass(): Argument #1 ($iteratorClass) must be a class name derived from ArrayIterator, FilterIterator given
+TypeError: ArrayObject::setIteratorClass(): Argument #1 ($iteratorClass) must be a class name derived from ArrayIterator, FilterIterator given
 int(42)
diff --git a/ext/spl/tests/bug81992.phpt b/ext/spl/tests/bug81992.phpt
index 52235218a78..73cda8840ad 100644
--- a/ext/spl/tests/bug81992.phpt
+++ b/ext/spl/tests/bug81992.phpt
@@ -9,12 +9,12 @@ public function __destruct() {
         try {
             var_dump($obj[2]);
         } catch (Throwable $e) {
-            echo $e->getMessage(), "\n";
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
         try {
             var_dump($obj[4]);
         } catch (Throwable $e) {
-            echo $e->getMessage(), "\n";
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
 }
@@ -28,5 +28,5 @@ public function __destruct() {
 ?>
 --EXPECT--
 string(10) "AAAAAAAAAA"
-Index invalid or out of range
-Index invalid or out of range
+OutOfBoundsException: Index invalid or out of range
+OutOfBoundsException: Index invalid or out of range
diff --git a/ext/spl/tests/class_implements_variation1.phpt b/ext/spl/tests/class_implements_variation1.phpt
index 1f7892f1283..058079ce53d 100644
--- a/ext/spl/tests/class_implements_variation1.phpt
+++ b/ext/spl/tests/class_implements_variation1.phpt
@@ -102,7 +102,7 @@ class classWithoutToString
       try {
         var_dump( class_implements($value, $autoload) );
       } catch (\TypeError $e) {
-          echo $e->getMessage() . \PHP_EOL;
+          echo $e::class, ': ', $e->getMessage(), PHP_EOL;
       }
 };

@@ -113,61 +113,61 @@ class classWithoutToString
 *** Testing class_implements() : variation ***

 --int 0--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given

 --int 1--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given

 --int 12345--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given

 --int -12345--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given

 --float 10.5--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given

 --float -10.5--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given

 --float 12.3456789000e10--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given

 --float -12.3456789000e10--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given

 --float .5--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given

 --empty array--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given

 --int indexed array--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given

 --associative array--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given

 --nested arrays--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given

 --uppercase NULL--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given

 --lowercase null--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given

 --lowercase true--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, true given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, true given

 --lowercase false--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, false given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, false given

 --uppercase TRUE--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, true given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, true given

 --uppercase FALSE--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, false given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, false given

 --empty string DQ--
 Error: 2 - class_implements(): Class  does not exist and could not be loaded, %s(%d)
@@ -188,10 +188,10 @@ class_implements(): Argument #1 ($object_or_class) must be of type object|string
 }

 --undefined var--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given

 --unset var--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given

 --resource--
-class_implements(): Argument #1 ($object_or_class) must be of type object|string, resource given
+TypeError: class_implements(): Argument #1 ($object_or_class) must be of type object|string, resource given
diff --git a/ext/spl/tests/class_uses_variation1.phpt b/ext/spl/tests/class_uses_variation1.phpt
index 016a9cc0d2f..53e628e6fd6 100644
--- a/ext/spl/tests/class_uses_variation1.phpt
+++ b/ext/spl/tests/class_uses_variation1.phpt
@@ -102,7 +102,7 @@ class classWithoutToString
       try {
         var_dump( class_uses($value, $autoload) );
       } catch (\TypeError $e) {
-          echo $e->getMessage() . \PHP_EOL;
+          echo $e::class, ': ', $e->getMessage(), PHP_EOL;
       }
 };

@@ -113,61 +113,61 @@ class classWithoutToString
 *** Testing class_uses() : variation ***

 --int 0--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given

 --int 1--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given

 --int 12345--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given

 --int -12345--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given

 --float 10.5--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given

 --float -10.5--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given

 --float 12.3456789000e10--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given

 --float -12.3456789000e10--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given

 --float .5--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given

 --empty array--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given

 --int indexed array--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given

 --associative array--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given

 --nested arrays--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given

 --uppercase NULL--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given

 --lowercase null--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given

 --lowercase true--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, true given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, true given

 --lowercase false--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, false given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, false given

 --uppercase TRUE--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, true given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, true given

 --uppercase FALSE--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, false given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, false given

 --empty string DQ--
 Error: 2 - class_uses(): Class  does not exist and could not be loaded, %s(%d)
@@ -186,10 +186,10 @@ class_uses(): Argument #1 ($object_or_class) must be of type object|string, fals
 }

 --undefined var--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given

 --unset var--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given

 --resource--
-class_uses(): Argument #1 ($object_or_class) must be of type object|string, resource given
+TypeError: class_uses(): Argument #1 ($object_or_class) must be of type object|string, resource given
diff --git a/ext/spl/tests/countable_count_variation1.phpt b/ext/spl/tests/countable_count_variation1.phpt
index b4b382bea35..19474d3b50a 100644
--- a/ext/spl/tests/countable_count_variation1.phpt
+++ b/ext/spl/tests/countable_count_variation1.phpt
@@ -54,7 +54,7 @@ function count() {
 try {
     echo count(new throwException);
 } catch (Exception $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
@@ -70,4 +70,4 @@ function count() {
 Count returns an array:
 int(1)
 Count throws an exception:
-Thrown from count
+Exception: Thrown from count
diff --git a/ext/spl/tests/dit_006.phpt b/ext/spl/tests/dit_006.phpt
index 42a2309c992..a83dc7e7569 100644
--- a/ext/spl/tests/dit_006.phpt
+++ b/ext/spl/tests/dit_006.phpt
@@ -35,7 +35,7 @@
     $di->seek($o+1);
     $p = 1;
 } catch (\OutOfBoundsException $ex) {
-    echo $ex->getMessage() . PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }

 var_dump($n !== $m, $m === $o, $p === 0);
@@ -44,7 +44,7 @@
 With seek(2) we get %d
 With seek(0) we get %d
 Without seek we get %d
-Seek position %d is out of range
+OutOfBoundsException: Seek position %d is out of range
 bool(true)
 bool(true)
 bool(true)
diff --git a/ext/spl/tests/dllist_001.phpt b/ext/spl/tests/dllist_001.phpt
index e6ac2468afd..7f02ce6b733 100644
--- a/ext/spl/tests/dllist_001.phpt
+++ b/ext/spl/tests/dllist_001.phpt
@@ -7,12 +7,12 @@
 try {
     $dll->pop();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $dll->shift();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 // data consistency
@@ -47,8 +47,8 @@
 echo count($dll)."\n";
 ?>
 --EXPECT--
-Exception: Can't pop from an empty datastructure
-Exception: Can't shift from an empty datastructure
+RuntimeException: Can't pop from an empty datastructure
+RuntimeException: Can't shift from an empty datastructure
 2
 2
 2
diff --git a/ext/spl/tests/dllist_004.phpt b/ext/spl/tests/dllist_004.phpt
index 8ac028ebf86..33ed21d4a65 100644
--- a/ext/spl/tests/dllist_004.phpt
+++ b/ext/spl/tests/dllist_004.phpt
@@ -7,12 +7,12 @@
 try {
     $stack->pop();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $stack->shift();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 // data consistency
@@ -45,8 +45,8 @@
 echo count($stack)."\n";
 ?>
 --EXPECT--
-Exception: Can't pop from an empty datastructure
-Exception: Can't shift from an empty datastructure
+RuntimeException: Can't pop from an empty datastructure
+RuntimeException: Can't shift from an empty datastructure
 2
 2
 [2]
diff --git a/ext/spl/tests/dllist_005.phpt b/ext/spl/tests/dllist_005.phpt
index 805f81a68a7..c5c8548ca7e 100644
--- a/ext/spl/tests/dllist_005.phpt
+++ b/ext/spl/tests/dllist_005.phpt
@@ -7,12 +7,12 @@
 try {
     $queue->dequeue();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $queue->shift();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 // data consistency
@@ -45,8 +45,8 @@
 echo count($queue)."\n";
 ?>
 --EXPECT--
-Exception: Can't shift from an empty datastructure
-Exception: Can't shift from an empty datastructure
+RuntimeException: Can't shift from an empty datastructure
+RuntimeException: Can't shift from an empty datastructure
 2
 2
 [1]
diff --git a/ext/spl/tests/dllist_006.phpt b/ext/spl/tests/dllist_006.phpt
index 25b8bf33088..1d0bec1ef49 100644
--- a/ext/spl/tests/dllist_006.phpt
+++ b/ext/spl/tests/dllist_006.phpt
@@ -24,25 +24,25 @@
 try {
     var_dump($a["1"]);
 } catch (OutOfRangeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     var_dump($a["a"]);
 } catch (TypeError $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     var_dump($a["0"]);
 } catch (OutOfRangeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     var_dump($a["9"]);
 } catch (OutOfRangeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
@@ -54,6 +54,6 @@
 int(3)
 int(4)
 int(2)
-Exception: SplDoublyLinkedList::offsetGet(): Argument #1 ($index) must be of type int, string given
+TypeError: SplDoublyLinkedList::offsetGet(): Argument #1 ($index) must be of type int, string given
 int(1)
-Exception: SplDoublyLinkedList::offsetGet(): Argument #1 ($index) is out of range
+OutOfRangeException: SplDoublyLinkedList::offsetGet(): Argument #1 ($index) is out of range
diff --git a/ext/spl/tests/dllist_013.phpt b/ext/spl/tests/dllist_013.phpt
index 2ec8396c0f5..8fc40eb877f 100644
--- a/ext/spl/tests/dllist_013.phpt
+++ b/ext/spl/tests/dllist_013.phpt
@@ -7,7 +7,7 @@
 try {
     $dll->add(2,5);
 } catch (OutOfRangeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $dll->add(0,6);						//	6
@@ -40,7 +40,7 @@

 ?>
 --EXPECT--
-Exception: SplDoublyLinkedList::add(): Argument #1 ($index) is out of range
+OutOfRangeException: SplDoublyLinkedList::add(): Argument #1 ($index) is out of range
 7
 7
 6
diff --git a/ext/spl/tests/fixedarray_003.phpt b/ext/spl/tests/fixedarray_003.phpt
index cca9ac07e9f..b5b3812cb71 100644
--- a/ext/spl/tests/fixedarray_003.phpt
+++ b/ext/spl/tests/fixedarray_003.phpt
@@ -14,17 +14,17 @@
 try {
     $o[[]] = 'd';
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $o[new stdClass()] = 'e';
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $o[$r] = 'f';
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $o['3'] = 'g';
@@ -32,17 +32,17 @@
 try {
     $o['3.5'] = 'h';
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $o['03'] = 'i';
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $o[' 3'] = 'j';
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }


@@ -54,17 +54,17 @@
 try {
     var_dump($o[[]]);
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($o[new stdClass()]);
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($o[$r]);
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump($o['3']);
@@ -72,17 +72,17 @@
 try {
     var_dump($o['3.5']);
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($o['03']);
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($o[' 3']);
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }


@@ -94,17 +94,17 @@
 try {
     var_dump(isset($o[[]]));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(isset($o[new stdClass()]));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(isset($o[$r]));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(isset($o['3']));
@@ -112,17 +112,17 @@
 try {
     var_dump(isset($o['3.5']));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(isset($o['03']));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(isset($o[' 3']));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo 'empty()', \PHP_EOL;
@@ -133,17 +133,17 @@
 try {
     var_dump(empty($o[[]]));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(empty($o[new stdClass()]));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(empty($o[$r]));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(empty($o['3']));
@@ -151,72 +151,72 @@
 try {
     var_dump(empty($o['3.5']));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(empty($o['03']));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(empty($o[' 3']));
 } catch (\TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
 Write context

 Deprecated: Implicit conversion from float 2.5 to int loses precision in %s on line %d
-Cannot access offset of type array on SplFixedArray
-Cannot access offset of type stdClass on SplFixedArray
+TypeError: Cannot access offset of type array on SplFixedArray
+TypeError: Cannot access offset of type stdClass on SplFixedArray

 Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Cannot access offset of type string on SplFixedArray
-Cannot access offset of type string on SplFixedArray
-Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
 Read context
 string(1) "a"
 string(1) "b"

 Deprecated: Implicit conversion from float 2.5 to int loses precision in %s on line %d
 string(1) "c"
-Cannot access offset of type array on SplFixedArray
-Cannot access offset of type stdClass on SplFixedArray
+TypeError: Cannot access offset of type array on SplFixedArray
+TypeError: Cannot access offset of type stdClass on SplFixedArray

 Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
 string(1) "f"
 string(1) "g"
-Cannot access offset of type string on SplFixedArray
-Cannot access offset of type string on SplFixedArray
-Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
 isset()
 bool(true)
 bool(true)

 Deprecated: Implicit conversion from float 2.5 to int loses precision in %s on line %d
 bool(true)
-Cannot access offset of type array on SplFixedArray
-Cannot access offset of type stdClass on SplFixedArray
+TypeError: Cannot access offset of type array on SplFixedArray
+TypeError: Cannot access offset of type stdClass on SplFixedArray

 Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
 bool(true)
 bool(true)
-Cannot access offset of type string on SplFixedArray
-Cannot access offset of type string on SplFixedArray
-Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
 empty()
 bool(false)
 bool(false)

 Deprecated: Implicit conversion from float 2.5 to int loses precision in %s on line %d
 bool(false)
-Cannot access offset of type array on SplFixedArray
-Cannot access offset of type stdClass on SplFixedArray
+TypeError: Cannot access offset of type array on SplFixedArray
+TypeError: Cannot access offset of type stdClass on SplFixedArray

 Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
 bool(false)
 bool(false)
-Cannot access offset of type string on SplFixedArray
-Cannot access offset of type string on SplFixedArray
-Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
+TypeError: Cannot access offset of type string on SplFixedArray
diff --git a/ext/spl/tests/fixedarray_004.phpt b/ext/spl/tests/fixedarray_004.phpt
index c1bf3054030..64773f7fdf5 100644
--- a/ext/spl/tests/fixedarray_004.phpt
+++ b/ext/spl/tests/fixedarray_004.phpt
@@ -8,9 +8,9 @@
 try {
     $a[] = 1;
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-[] operator not supported for SplFixedArray
+Error: [] operator not supported for SplFixedArray
diff --git a/ext/spl/tests/fixedarray_006.phpt b/ext/spl/tests/fixedarray_006.phpt
index 75ecbb7c7f2..6bf1ae0bc23 100644
--- a/ext/spl/tests/fixedarray_006.phpt
+++ b/ext/spl/tests/fixedarray_006.phpt
@@ -11,12 +11,12 @@
         $a[] = new stdClass;
     }
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 print "ok\n";

 ?>
 --EXPECT--
-[] operator not supported for SplFixedArray
+Error: [] operator not supported for SplFixedArray
 ok
diff --git a/ext/spl/tests/fixedarray_007.phpt b/ext/spl/tests/fixedarray_007.phpt
index 65b4dad90e2..1bb80f26054 100644
--- a/ext/spl/tests/fixedarray_007.phpt
+++ b/ext/spl/tests/fixedarray_007.phpt
@@ -9,7 +9,7 @@
 try {
     $a[1] = $a;
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 foreach ($a as $c) {
diff --git a/ext/spl/tests/fixedarray_012.phpt b/ext/spl/tests/fixedarray_012.phpt
index 0c54dc10552..961e0022b04 100644
--- a/ext/spl/tests/fixedarray_012.phpt
+++ b/ext/spl/tests/fixedarray_012.phpt
@@ -8,12 +8,12 @@
 try {
     $b = &$a[];
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 print "ok\n";

 ?>
 --EXPECT--
-[] operator not supported for SplFixedArray
+Error: [] operator not supported for SplFixedArray
 ok
diff --git a/ext/spl/tests/fixedarray_013.phpt b/ext/spl/tests/fixedarray_013.phpt
index fa0d33a4165..9c6488602f7 100644
--- a/ext/spl/tests/fixedarray_013.phpt
+++ b/ext/spl/tests/fixedarray_013.phpt
@@ -13,9 +13,9 @@ function test(SplFixedArray &$arr) {
 try {
     test($a[]);
 } catch (\Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-[] operator not supported for SplFixedArray
+Error: [] operator not supported for SplFixedArray
diff --git a/ext/spl/tests/fixedarray_014.phpt b/ext/spl/tests/fixedarray_014.phpt
index 75108b58684..94bbfb884c3 100644
--- a/ext/spl/tests/fixedarray_014.phpt
+++ b/ext/spl/tests/fixedarray_014.phpt
@@ -7,9 +7,9 @@
     $a = new SplFixedArray(0);
     echo $a[0]++;
 } catch (Exception $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Index invalid or out of range
+OutOfBoundsException: Index invalid or out of range
diff --git a/ext/spl/tests/fixedarray_020.phpt b/ext/spl/tests/fixedarray_020.phpt
index c0ff6e3b436..6152e199fba 100644
--- a/ext/spl/tests/fixedarray_020.phpt
+++ b/ext/spl/tests/fixedarray_020.phpt
@@ -14,14 +14,14 @@
     SplFixedArray::fromArray(array("foo"=>"bar"), false);
     echo "No exception\n";
 } catch (Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     echo "From Array with string keys, preserve\n";
     SplFixedArray::fromArray(array("foo"=>"bar"), true);
     echo "No exception\n";
 } catch (Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
@@ -33,4 +33,4 @@
 From Array with string keys, no preserve
 No exception
 From Array with string keys, preserve
-Exception: array must contain only positive integer keys
+InvalidArgumentException: array must contain only positive integer keys
diff --git a/ext/spl/tests/fixedarray_021.phpt b/ext/spl/tests/fixedarray_021.phpt
index 376985fd5d2..0f2bd694c67 100644
--- a/ext/spl/tests/fixedarray_021.phpt
+++ b/ext/spl/tests/fixedarray_021.phpt
@@ -13,7 +13,7 @@
 try {
     $b = new SplFixedArray(-10);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 /* resize and negative value */
@@ -21,7 +21,7 @@
 try {
     $b->setSize(-5);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 /* calling __construct() twice */
@@ -47,7 +47,7 @@
         var_dump($v);
     }
 } catch (\Error $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 //non-long indexes
@@ -63,14 +63,14 @@
 --EXPECTF--
 int(0)
 int(0)
-SplFixedArray::__construct(): Argument #1 ($size) must be greater than or equal to 0
-SplFixedArray::setSize(): Argument #1 ($size) must be greater than or equal to 0
+ValueError: SplFixedArray::__construct(): Argument #1 ($size) must be greater than or equal to 0
+ValueError: SplFixedArray::setSize(): Argument #1 ($size) must be greater than or equal to 0
 NULL
 int(0)
 int(0)
 object(SplFixedArray)#%d (0) {
 }
-string(52) "An iterator cannot be used with foreach by reference"
+Error: An iterator cannot be used with foreach by reference
 bool(false)
 string(3) "foo"
 bool(true)
diff --git a/ext/spl/tests/fixedarray_023.phpt b/ext/spl/tests/fixedarray_023.phpt
index 781685b7891..9f2506eb2d8 100644
--- a/ext/spl/tests/fixedarray_023.phpt
+++ b/ext/spl/tests/fixedarray_023.phpt
@@ -33,4 +33,4 @@
   *RECURSION*
   [3]=>
   *RECURSION*
-}
\ No newline at end of file
+}
diff --git a/ext/spl/tests/gh13685.phpt b/ext/spl/tests/gh13685.phpt
index 2bdddec4584..3f79f9280f5 100644
--- a/ext/spl/tests/gh13685.phpt
+++ b/ext/spl/tests/gh13685.phpt
@@ -19,7 +19,7 @@
 try {
     var_dump((string) $file);
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "--- Use csv control ---\n";
@@ -35,7 +35,7 @@
 try {
     var_dump((string) $file);
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
diff --git a/ext/spl/tests/gh16217.phpt b/ext/spl/tests/gh16217.phpt
index 71760389c8e..c6a0846e64f 100644
--- a/ext/spl/tests/gh16217.phpt
+++ b/ext/spl/tests/gh16217.phpt
@@ -9,13 +9,13 @@ function uninitialized(): SplFileObject {
 try {
     (new ReflectionMethod(SplFileObject::class, "fputcsv"))->invoke(uninitialized(), []);
 } catch (Error $e) {
-    echo "fputcsv: ", $e->getMessage(), "\n";
+    echo 'fputcsv: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     (new ReflectionMethod(SplFileObject::class, "next"))->invoke(uninitialized());
 } catch (Error $e) {
-    echo "next: ", $e->getMessage(), "\n";
+    echo 'next: ', $e::class, ': ', $e->getMessage(), "\n";
 }

 $obj = uninitialized();
@@ -23,13 +23,13 @@ function uninitialized(): SplFileObject {
 try {
     (new ReflectionMethod(SplFileObject::class, "next"))->invoke($obj);
 } catch (Error $e) {
-    echo "next (READ_AHEAD): ", $e->getMessage(), "\n";
+    echo 'next (READ_AHEAD): ', $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Done\n";
 ?>
 --EXPECT--
-fputcsv: Object not initialized
-next: Object not initialized
-next (READ_AHEAD): Object not initialized
+fputcsv: Error: Object not initialized
+next: Error: Object not initialized
+next (READ_AHEAD): Error: Object not initialized
 Done
diff --git a/ext/spl/tests/gh16337.phpt b/ext/spl/tests/gh16337.phpt
index 94cf9d90cb1..6b6424b0f68 100644
--- a/ext/spl/tests/gh16337.phpt
+++ b/ext/spl/tests/gh16337.phpt
@@ -9,12 +9,12 @@ function __toString() {
         try {
             $heap->extract();
         } catch (Throwable $e) {
-            echo $e->getMessage(), "\n";
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
         try {
             $heap->insert(1);
         } catch (Throwable $e) {
-            echo $e->getMessage(), "\n";
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
         echo $heap->top(), "\n";
         return "0";
@@ -29,21 +29,21 @@ function __toString() {

 ?>
 --EXPECT--
-Heap cannot be changed when it is already being modified.
-Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
 0
-Heap cannot be changed when it is already being modified.
-Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
 0
-Heap cannot be changed when it is already being modified.
-Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
 0
-Heap cannot be changed when it is already being modified.
-Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
 0
-Heap cannot be changed when it is already being modified.
-Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
 0
-Heap cannot be changed when it is already being modified.
-Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
 0
diff --git a/ext/spl/tests/gh16604_2.phpt b/ext/spl/tests/gh16604_2.phpt
index 703b37ce87d..04264639371 100644
--- a/ext/spl/tests/gh16604_2.phpt
+++ b/ext/spl/tests/gh16604_2.phpt
@@ -9,7 +9,7 @@
 try {
     $obj->__construct(__DIR__.'/gh16604_2.tmp');
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -18,4 +18,4 @@
 @unlink(__DIR__.'/gh16604_2.tmp');
 ?>
 --EXPECT--
-Cannot call constructor twice
+Error: Cannot call constructor twice
diff --git a/ext/spl/tests/gh17463.phpt b/ext/spl/tests/gh17463.phpt
index 41939c62f5b..60524dd96b2 100644
--- a/ext/spl/tests/gh17463.phpt
+++ b/ext/spl/tests/gh17463.phpt
@@ -9,8 +9,8 @@
 try {
 	$cls->ftruncate(-1);
 } catch (\ValueError $e) {
-	echo $e->getMessage();
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-SplFileObject::ftruncate(): Argument #1 ($size) must be greater than or equal to 0
+ValueError: SplFileObject::ftruncate(): Argument #1 ($size) must be greater than or equal to 0
diff --git a/ext/spl/tests/gh17516.phpt b/ext/spl/tests/gh17516.phpt
index f1a05f9ca18..669f2286abd 100644
--- a/ext/spl/tests/gh17516.phpt
+++ b/ext/spl/tests/gh17516.phpt
@@ -11,7 +11,7 @@ class BadSplFileInfo {}
 try {
 	$cls->getPathInfo('BadSplFileInfo');
 } catch (\TypeError $e) {
-	echo $e->getMessage();
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
@@ -21,4 +21,4 @@ class BadSplFileInfo {}
   ["fileName":"SplFileInfo":private]=>
   string(4) "php:"
 }
-SplFileInfo::getPathInfo(): Argument #1 ($class) must be a class name derived from SplFileInfo or null, BadSplFileInfo given
+TypeError: SplFileInfo::getPathInfo(): Argument #1 ($class) must be a class name derived from SplFileInfo or null, BadSplFileInfo given
diff --git a/ext/spl/tests/gh18421.phpt b/ext/spl/tests/gh18421.phpt
index 42584ef8aac..7b2306f0a9f 100644
--- a/ext/spl/tests/gh18421.phpt
+++ b/ext/spl/tests/gh18421.phpt
@@ -9,9 +9,9 @@
     {
     }
 } catch (OutOfBoundsException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-Seek position %d is out of range
+OutOfBoundsException: Seek position %d is out of range
diff --git a/ext/spl/tests/gh19094.phpt b/ext/spl/tests/gh19094.phpt
index d0665c3e8f0..6e507c26aaa 100644
--- a/ext/spl/tests/gh19094.phpt
+++ b/ext/spl/tests/gh19094.phpt
@@ -35,22 +35,22 @@ public function getIterator(): Traversable
 try {
     $cls[$canary] = 1;
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $cls[new MyAggregate] = 1;
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 $cls[new MyIterator] = 1;
 try {
     $cls->key();
 } catch (RuntimeException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Can only attach objects that implement the Iterator interface
-Can only attach objects that implement the Iterator interface
-Called key() with non valid sub iterator
+TypeError: Can only attach objects that implement the Iterator interface
+TypeError: Can only attach objects that implement the Iterator interface
+RuntimeException: Called key() with non valid sub iterator
diff --git a/ext/spl/tests/heap_001.phpt b/ext/spl/tests/heap_001.phpt
index 33f091838b0..438a62fe596 100644
--- a/ext/spl/tests/heap_001.phpt
+++ b/ext/spl/tests/heap_001.phpt
@@ -8,7 +8,7 @@
 try {
     $h->extract();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }


@@ -37,7 +37,7 @@
 echo $h2->extract()."\n";
 ?>
 --EXPECT--
-Exception: Can't extract from an empty heap
+RuntimeException: Can't extract from an empty heap
 5
 3
 3
diff --git a/ext/spl/tests/heap_002.phpt b/ext/spl/tests/heap_002.phpt
index 452fdf189a7..ce62a4bd085 100644
--- a/ext/spl/tests/heap_002.phpt
+++ b/ext/spl/tests/heap_002.phpt
@@ -8,7 +8,7 @@
 try {
     $h->extract();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }


@@ -35,7 +35,7 @@
 echo $h->extract()."\n";
 ?>
 --EXPECT--
-Exception: Can't extract from an empty heap
+RuntimeException: Can't extract from an empty heap
 5
 1
 2
diff --git a/ext/spl/tests/heap_004.phpt b/ext/spl/tests/heap_004.phpt
index 3db18b67338..70f10c3ab31 100644
--- a/ext/spl/tests/heap_004.phpt
+++ b/ext/spl/tests/heap_004.phpt
@@ -18,25 +18,25 @@ public function compare($a, $b): int {
     $h->insert(3);
     echo "inserted 3\n";
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $h->insert(4);
     echo "inserted 4\n";
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     var_dump($h->extract());
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($h->extract());
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Recovering..\n";
@@ -45,20 +45,20 @@ public function compare($a, $b): int {
 try {
     var_dump($h->extract());
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($h->extract());
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
 inserted 1
 Exception: foo
-Exception: Heap is corrupted, heap properties are no longer ensured.
-Exception: Heap is corrupted, heap properties are no longer ensured.
-Exception: Heap is corrupted, heap properties are no longer ensured.
+RuntimeException: Heap is corrupted, heap properties are no longer ensured.
+RuntimeException: Heap is corrupted, heap properties are no longer ensured.
+RuntimeException: Heap is corrupted, heap properties are no longer ensured.
 Recovering..
 int(1)
 int(2)
diff --git a/ext/spl/tests/heap_009.phpt b/ext/spl/tests/heap_009.phpt
index 833d079b253..1b3b3a7dd3e 100644
--- a/ext/spl/tests/heap_009.phpt
+++ b/ext/spl/tests/heap_009.phpt
@@ -13,7 +13,7 @@ function testForException( $heap )
     }
     catch( \Error $e )
     {
-        echo $e->getMessage(),"\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }

@@ -46,9 +46,9 @@ function testForException( $heap )

 ?>
 --EXPECT--
-An iterator cannot be used with foreach by reference
-An iterator cannot be used with foreach by reference
-An iterator cannot be used with foreach by reference
-An iterator cannot be used with foreach by reference
-An iterator cannot be used with foreach by reference
-An iterator cannot be used with foreach by reference
+Error: An iterator cannot be used with foreach by reference
+Error: An iterator cannot be used with foreach by reference
+Error: An iterator cannot be used with foreach by reference
+Error: An iterator cannot be used with foreach by reference
+Error: An iterator cannot be used with foreach by reference
+Error: An iterator cannot be used with foreach by reference
diff --git a/ext/spl/tests/heap_corruption.phpt b/ext/spl/tests/heap_corruption.phpt
index 149d0b67199..9e75cce3545 100644
--- a/ext/spl/tests/heap_corruption.phpt
+++ b/ext/spl/tests/heap_corruption.phpt
@@ -48,14 +48,14 @@ public function compare($v1, $v2): int
     $heap->extract();
 }
 catch (Exception $e) {
-    echo "Compare Exception: " . $e->getMessage() . PHP_EOL;
+    echo 'Compare: ', $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     $heap->top();
 }
 catch (Exception $e) {
-    echo "Corruption Exception: " . $e->getMessage() . PHP_EOL;
+    echo 'Corruption: ', $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 var_dump($heap->isCorrupted());
@@ -64,7 +64,7 @@ public function compare($v1, $v2): int
 ?>
 --EXPECT--
 bool(false)
-Compare Exception: Compare exception
-Corruption Exception: Heap is corrupted, heap properties are no longer ensured.
+Compare: Exception: Compare exception
+Corruption: RuntimeException: Heap is corrupted, heap properties are no longer ensured.
 bool(true)
 bool(false)
diff --git a/ext/spl/tests/heap_next_write_lock.phpt b/ext/spl/tests/heap_next_write_lock.phpt
index fcad94f3ccd..f8beafbdddd 100644
--- a/ext/spl/tests/heap_next_write_lock.phpt
+++ b/ext/spl/tests/heap_next_write_lock.phpt
@@ -26,7 +26,7 @@ public function compare(mixed $p1, mixed $p2): int {
         $q->insert("d$i", 100 - $i);
     }
 } catch (RuntimeException $e) {
-    echo $e::class, ": ", $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
diff --git a/ext/spl/tests/heap_top_variation_002.phpt b/ext/spl/tests/heap_top_variation_002.phpt
index 0a9a8db613b..48f995e9c23 100644
--- a/ext/spl/tests/heap_top_variation_002.phpt
+++ b/ext/spl/tests/heap_top_variation_002.phpt
@@ -24,8 +24,8 @@ public function compare($a, $b): int {
 try {
     $h->top();
 } catch (Exception $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-Heap is corrupted, heap properties are no longer ensured.
+RuntimeException: Heap is corrupted, heap properties are no longer ensured.
diff --git a/ext/spl/tests/heap_top_variation_003.phpt b/ext/spl/tests/heap_top_variation_003.phpt
index 40d70c5966b..466723c1220 100644
--- a/ext/spl/tests/heap_top_variation_003.phpt
+++ b/ext/spl/tests/heap_top_variation_003.phpt
@@ -9,8 +9,8 @@
 try {
     $h->top();
 } catch (Exception $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-Can't peek at an empty heap
+RuntimeException: Can't peek at an empty heap
diff --git a/ext/spl/tests/heap_unserialize_under_corruption_or_modification.phpt b/ext/spl/tests/heap_unserialize_under_corruption_or_modification.phpt
index 2e54be09ad1..0523aad9f47 100644
--- a/ext/spl/tests/heap_unserialize_under_corruption_or_modification.phpt
+++ b/ext/spl/tests/heap_unserialize_under_corruption_or_modification.phpt
@@ -22,9 +22,9 @@ public function compare($a, $b): int {
 try {
     $heap->insert(2);
 } catch (RuntimeException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Heap cannot be changed when it is already being modified.
+RuntimeException: Heap cannot be changed when it is already being modified.
diff --git a/ext/spl/tests/iterator_022.phpt b/ext/spl/tests/iterator_022.phpt
index fda42a97c83..afe024df0df 100644
--- a/ext/spl/tests/iterator_022.phpt
+++ b/ext/spl/tests/iterator_022.phpt
@@ -121,7 +121,7 @@ function endChildren(): void
 }
 catch(UnexpectedValueException $e)
 {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -180,4 +180,4 @@ function endChildren(): void
 RecursiveArrayIteratorIterator::endChildren(1)
 RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
 RecursiveArrayIteratorIterator::callGetChildren(skip)
-Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator
+UnexpectedValueException: Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator
diff --git a/ext/spl/tests/iterator_023.phpt b/ext/spl/tests/iterator_023.phpt
index 8c7121ff2cb..2ce54132abc 100644
--- a/ext/spl/tests/iterator_023.phpt
+++ b/ext/spl/tests/iterator_023.phpt
@@ -121,7 +121,7 @@ function endChildren(): void
 }
 catch(UnexpectedValueException $e)
 {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
diff --git a/ext/spl/tests/iterator_024.phpt b/ext/spl/tests/iterator_024.phpt
index 21f0216d9b9..9fc13e82d3e 100644
--- a/ext/spl/tests/iterator_024.phpt
+++ b/ext/spl/tests/iterator_024.phpt
@@ -16,7 +16,7 @@
 }
 catch (InvalidArgumentException $e)
 {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "===MANUAL===\n";
@@ -35,7 +35,7 @@
 331
 4
 string(13) "ArrayIterator"
-An instance of RecursiveIterator or IteratorAggregate creating it is required
+InvalidArgumentException: An instance of RecursiveIterator or IteratorAggregate creating it is required
 ===MANUAL===
 string(22) "RecursiveArrayIterator"
 1
diff --git a/ext/spl/tests/iterator_028.phpt b/ext/spl/tests/iterator_028.phpt
index 92e00b4f78b..9f9990e4b0d 100644
--- a/ext/spl/tests/iterator_028.phpt
+++ b/ext/spl/tests/iterator_028.phpt
@@ -43,7 +43,7 @@
 try {
     $it->setMaxDepth(-2);
 } catch(\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 var_dump($it->getMaxDepth());
 ?>
@@ -102,5 +102,5 @@
 0: 4
 ===-1===
 bool(false)
-RecursiveIteratorIterator::setMaxDepth(): Argument #1 ($maxDepth) must be greater than or equal to -1
+ValueError: RecursiveIteratorIterator::setMaxDepth(): Argument #1 ($maxDepth) must be greater than or equal to -1
 int(4)
diff --git a/ext/spl/tests/iterator_030.phpt b/ext/spl/tests/iterator_030.phpt
index 6a684ec3000..0520260b690 100644
--- a/ext/spl/tests/iterator_030.phpt
+++ b/ext/spl/tests/iterator_030.phpt
@@ -17,7 +17,7 @@
 }
 catch(BadMethodCallException $e)
 {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try
@@ -26,7 +26,7 @@
 }
 catch(BadMethodCallException $e)
 {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump($it->valid());
@@ -36,6 +36,6 @@
 bool(false)
 bool(false)
 bool(false)
-Accessing the key of an EmptyIterator
-Accessing the value of an EmptyIterator
+BadMethodCallException: Accessing the key of an EmptyIterator
+BadMethodCallException: Accessing the value of an EmptyIterator
 bool(false)
diff --git a/ext/spl/tests/iterator_031.phpt b/ext/spl/tests/iterator_031.phpt
index c2b5885dd23..388512e4850 100644
--- a/ext/spl/tests/iterator_031.phpt
+++ b/ext/spl/tests/iterator_031.phpt
@@ -60,7 +60,7 @@ function parent__construct() {
 try {
     $ap->append($it);
 } catch(\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $ap->parent__construct();
@@ -68,7 +68,7 @@ function parent__construct() {
 try {
     $ap->parent__construct($it);
 } catch(BadMethodCallException $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $ap->append($it);
@@ -87,8 +87,8 @@ function parent__construct() {
 1=>2
 MyAppendIterator::__construct
 MyAppendIterator::append
-The object is in an invalid state as the parent constructor was not called
-AppendIterator::getIterator() must be called exactly once per instance
+Error: The object is in an invalid state as the parent constructor was not called
+BadMethodCallException: AppendIterator::getIterator() must be called exactly once per instance
 MyAppendIterator::append
 MyArrayIterator::rewind
 MyAppendIterator::append
diff --git a/ext/spl/tests/iterator_032.phpt b/ext/spl/tests/iterator_032.phpt
index 9f56d7574db..a08320cc56d 100644
--- a/ext/spl/tests/iterator_032.phpt
+++ b/ext/spl/tests/iterator_032.phpt
@@ -17,7 +17,7 @@
 }
 catch(OutOfBoundsException $e)
 {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $it->seek(2);
@@ -29,7 +29,7 @@
 }
 catch(OutOfBoundsException $e)
 {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $it->next();
@@ -41,7 +41,7 @@
 int(1)
 2=>3
 int(2)
-Cannot seek to 0 which is below the offset 1
+OutOfBoundsException: Cannot seek to 0 which is below the offset 1
 int(3)
-Cannot seek to 3 which is behind offset 1 plus count 2
+OutOfBoundsException: Cannot seek to 3 which is behind offset 1 plus count 2
 bool(false)
diff --git a/ext/spl/tests/iterator_037.phpt b/ext/spl/tests/iterator_037.phpt
index c6c465baa2b..011c63138bc 100644
--- a/ext/spl/tests/iterator_037.phpt
+++ b/ext/spl/tests/iterator_037.phpt
@@ -10,7 +10,7 @@ function test($ar, $flags)
     try {
         $it->setFlags($flags);
     } catch (\ValueError $e) {
-        echo 'Exception: ' . $e->getMessage() . "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
         var_dump($it->getFlags());
         return;
     }
@@ -21,7 +21,7 @@ function test($ar, $flags)
             var_dump((string)$it);
         }
     } catch (Exception $e) {
-        echo 'Exception: ' . $e->getMessage() . "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }

@@ -66,7 +66,7 @@ function __toString()
 }
 catch (Exception $e)
 {
-    echo 'Exception: ' . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try
 {
@@ -75,7 +75,7 @@ function __toString()
 }
 catch (Exception $e)
 {
-    echo 'Exception: ' . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -101,20 +101,20 @@ function __toString()
 string(3) "1:2"
 string(3) "2:3"
 ===3===
-Exception: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
+ValueError: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
 int(0)
 ===5===
-Exception: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
+ValueError: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
 int(0)
 ===9===
-Exception: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
+ValueError: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
 int(0)
 ===6===
-Exception: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
+ValueError: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
 int(0)
 ===10===
-Exception: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
+ValueError: CachingIterator::setFlags(): Argument #1 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
 int(0)
 ===X===
-Exception: Unsetting flag CALL_TO_STRING is not possible
-Exception: Unsetting flag TOSTRING_USE_INNER is not possible
+InvalidArgumentException: Unsetting flag CALL_TO_STRING is not possible
+InvalidArgumentException: Unsetting flag TOSTRING_USE_INNER is not possible
diff --git a/ext/spl/tests/iterator_041.phpt b/ext/spl/tests/iterator_041.phpt
index 1fc73c1a1dd..3d3266db66c 100644
--- a/ext/spl/tests/iterator_041.phpt
+++ b/ext/spl/tests/iterator_041.phpt
@@ -72,7 +72,7 @@ static function test($func, $skip = null)
             }
             catch (Exception $e)
             {
-                echo $e->getMessage() . "\n";
+                echo $e::class, ': ', $e->getMessage(), "\n";
             }
             if (isset($skip[self::$fail]))
             {
@@ -92,13 +92,13 @@ static function test($func, $skip = null)
 ?>
 --EXPECT--
 ===iterator_to_array===
-State 0: __construct()
-State 1: __construct()
-State 2: rewind()
-State 3: valid()
-State 4: current()
-State 5: key()
-State 6: next()
+Exception: State 0: __construct()
+Exception: State 1: __construct()
+Exception: State 2: rewind()
+Exception: State 3: valid()
+Exception: State 4: current()
+Exception: State 5: key()
+Exception: State 6: next()
 array(2) {
   [0]=>
   int(1)
@@ -106,9 +106,9 @@ static function test($func, $skip = null)
   int(2)
 }
 ===iterator_count===
-State 0: __construct()
-State 1: __construct()
-State 2: rewind()
-State 3: valid()
-State 6: next()
+Exception: State 0: __construct()
+Exception: State 1: __construct()
+Exception: State 2: rewind()
+Exception: State 3: valid()
+Exception: State 6: next()
 int(2)
diff --git a/ext/spl/tests/iterator_041a.phpt b/ext/spl/tests/iterator_041a.phpt
index d57735dc2cd..5a316a109a3 100644
--- a/ext/spl/tests/iterator_041a.phpt
+++ b/ext/spl/tests/iterator_041a.phpt
@@ -72,7 +72,7 @@ static function test($func, $skip = null)
             }
             catch (Exception $e)
             {
-                echo $e->getMessage() . "\n";
+                echo $e::class, ': ', $e->getMessage(), "\n";
             }
             if (isset($skip[self::$fail]))
             {
@@ -92,7 +92,7 @@ static function test($func, $skip = null)
 ?>
 --EXPECT--
 ===iterator_to_array===
-State 7: __destruct()
+Exception: State 7: __destruct()
 array(2) {
   [0]=>
   int(1)
@@ -100,5 +100,5 @@ static function test($func, $skip = null)
   int(2)
 }
 ===iterator_count===
-State 7: __destruct()
+Exception: State 7: __destruct()
 int(2)
diff --git a/ext/spl/tests/iterator_041b.phpt b/ext/spl/tests/iterator_041b.phpt
index 83d9388161e..48c57882826 100644
--- a/ext/spl/tests/iterator_041b.phpt
+++ b/ext/spl/tests/iterator_041b.phpt
@@ -72,7 +72,7 @@ static function test($func, $skip = null)
             }
             catch (Exception $e)
             {
-                echo $e->getMessage() . "\n";
+                echo $e::class, ': ', $e->getMessage(), "\n";
             }
             if (isset($skip[self::$fail]))
             {
@@ -96,14 +96,14 @@ static function test($func, $skip = null)
 ?>
 --EXPECT--
 ===iterator_to_array===
-State 0: __construct()
-State 1: __construct()
-State 2: rewind()
-State 3: valid()
-State 4: current()
-State 5: key()
-State 6: next()
-State 7: __destruct()
+Exception: State 0: __construct()
+Exception: State 1: __construct()
+Exception: State 2: rewind()
+Exception: State 3: valid()
+Exception: State 4: current()
+Exception: State 5: key()
+Exception: State 6: next()
+Exception: State 7: __destruct()
 array(2) {
   [0]=>
   int(1)
@@ -111,10 +111,10 @@ static function test($func, $skip = null)
   int(2)
 }
 ===iterator_count===
-State 0: __construct()
-State 1: __construct()
-State 2: rewind()
-State 3: valid()
-State 6: next()
-State 7: __destruct()
+Exception: State 0: __construct()
+Exception: State 1: __construct()
+Exception: State 2: rewind()
+Exception: State 3: valid()
+Exception: State 6: next()
+Exception: State 7: __destruct()
 int(2)
diff --git a/ext/spl/tests/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt
index 74321194e09..64b545118bb 100644
--- a/ext/spl/tests/iterator_044.phpt
+++ b/ext/spl/tests/iterator_044.phpt
@@ -27,12 +27,12 @@ function test($ar)
             try {
                 var_dump($this->offsetExists($v));
             } catch (TypeError $e) {
-                echo $e->getMessage(), "\n";
+                echo $e::class, ': ', $e->getMessage(), "\n";
             }
             try {
                 var_dump($this->offsetGet($v));
             } catch (TypeError $e) {
-                echo $e->getMessage(), "\n";
+                echo $e::class, ': ', $e->getMessage(), "\n";
             }
         }
     }
@@ -46,7 +46,7 @@ function test($ar)
 }
 catch(Exception $e)
 {
-    echo "Exception: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try
@@ -55,7 +55,7 @@ function test($ar)
 }
 catch(Exception $e)
 {
-    echo "Exception: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)), CachingIterator::FULL_CACHE);
@@ -72,8 +72,8 @@ function test($ar)

 ?>
 --EXPECTF--
-Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
-Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
+BadMethodCallException: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
+BadMethodCallException: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
 ===0===
 int(0)
 bool(false)
@@ -83,8 +83,8 @@ function test($ar)
 ===1===
 object(stdClass)#%d (0) {
 }
-CachingIterator::offsetExists(): Argument #1 ($key) must be of type string, stdClass given
-CachingIterator::offsetGet(): Argument #1 ($key) must be of type string, stdClass given
+TypeError: CachingIterator::offsetExists(): Argument #1 ($key) must be of type string, stdClass given
+TypeError: CachingIterator::offsetGet(): Argument #1 ($key) must be of type string, stdClass given
 ===2===
 object(MyFoo)#%d (0) {
 }
@@ -128,8 +128,8 @@ function test($ar)
 ===1===
 object(stdClass)#1 (0) {
 }
-CachingIterator::offsetExists(): Argument #1 ($key) must be of type string, stdClass given
-CachingIterator::offsetGet(): Argument #1 ($key) must be of type string, stdClass given
+TypeError: CachingIterator::offsetExists(): Argument #1 ($key) must be of type string, stdClass given
+TypeError: CachingIterator::offsetGet(): Argument #1 ($key) must be of type string, stdClass given
 ===2===
 object(MyFoo)#2 (0) {
 }
diff --git a/ext/spl/tests/iterator_045.phpt b/ext/spl/tests/iterator_045.phpt
index e245b956888..fed62cc1e71 100644
--- a/ext/spl/tests/iterator_045.phpt
+++ b/ext/spl/tests/iterator_045.phpt
@@ -59,7 +59,7 @@ function show()
 }
 catch(Exception $e)
 {
-    echo "Exception: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try
@@ -68,7 +68,7 @@ function show()
 }
 catch(Exception $e)
 {
-    echo "Exception: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $it = new MyCachingIterator(new ArrayIterator(array(0, 1, 2, 3)), CachingIterator::FULL_CACHE);
@@ -89,8 +89,8 @@ function show()

 ?>
 --EXPECT--
-Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
-Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
+BadMethodCallException: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
+BadMethodCallException: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
 MyCachingIterator::testSet()
 set(0,25)
 set(1,42)
diff --git a/ext/spl/tests/iterator_047.phpt b/ext/spl/tests/iterator_047.phpt
index 353990856bd..e5fd299acc3 100644
--- a/ext/spl/tests/iterator_047.phpt
+++ b/ext/spl/tests/iterator_047.phpt
@@ -48,7 +48,7 @@ function show()
             }
             catch (Exception $e)
             {
-                echo "Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
+                echo $e::class, ': ', $e->getMessage(), ' in ', $e->getFile(), "\n";
             }
             MyRecursiveArrayIterator::$fail++;
         }
@@ -88,14 +88,14 @@ function show()
 int(4)
 ===1===
 MyRecursiveArrayIterator::hasChildren()
-Exception: State 1: MyRecursiveArrayIterator::hasChildren() in %s on line %d
+Exception: State 1: MyRecursiveArrayIterator::hasChildren() in %s
 ===2===
 MyRecursiveArrayIterator::hasChildren()
 int(0)
 int(0)
 MyRecursiveArrayIterator::hasChildren()
 MyRecursiveArrayIterator::getChildren()
-Exception: State 2: MyRecursiveArrayIterator::getChildren() in %s on line %d
+Exception: State 2: MyRecursiveArrayIterator::getChildren() in %s
 ===3===
 MyRecursiveArrayIterator::hasChildren()
 int(0)
diff --git a/ext/spl/tests/iterator_056.phpt b/ext/spl/tests/iterator_056.phpt
index 84427b8707d..477d71037bb 100644
--- a/ext/spl/tests/iterator_056.phpt
+++ b/ext/spl/tests/iterator_056.phpt
@@ -22,43 +22,43 @@ class myNoRewindIterator extends NoRewindIterator  {}
 try {
     $it = new myFilterIterator();
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

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

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

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

 try {
     $it = new myLimitIterator();
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $it = new myNoRewindIterator();
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-FilterIterator::__construct() expects exactly 1 argument, 0 given
-CachingIterator::__construct() expects at least 1 argument, 0 given
-RecursiveCachingIterator::__construct() expects at least 1 argument, 0 given
-ParentIterator::__construct() expects exactly 1 argument, 0 given
-LimitIterator::__construct() expects at least 1 argument, 0 given
-NoRewindIterator::__construct() expects exactly 1 argument, 0 given
+ArgumentCountError: FilterIterator::__construct() expects exactly 1 argument, 0 given
+ArgumentCountError: CachingIterator::__construct() expects at least 1 argument, 0 given
+ArgumentCountError: RecursiveCachingIterator::__construct() expects at least 1 argument, 0 given
+ArgumentCountError: ParentIterator::__construct() expects exactly 1 argument, 0 given
+ArgumentCountError: LimitIterator::__construct() expects at least 1 argument, 0 given
+ArgumentCountError: NoRewindIterator::__construct() expects exactly 1 argument, 0 given
diff --git a/ext/spl/tests/iterator_062.phpt b/ext/spl/tests/iterator_062.phpt
index 904b7f0ccfd..bbea651c223 100644
--- a/ext/spl/tests/iterator_062.phpt
+++ b/ext/spl/tests/iterator_062.phpt
@@ -11,8 +11,8 @@ class myRecursiveIteratorIterator extends RecursiveIteratorIterator {
 try {
     $it = new myRecursiveIteratorIterator();
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-RecursiveIteratorIterator::__construct() expects at least 1 argument, 0 given
+ArgumentCountError: RecursiveIteratorIterator::__construct() expects at least 1 argument, 0 given
diff --git a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
index c5fc21ea8bc..b0635e34c1f 100644
--- a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
+++ b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
@@ -15,7 +15,7 @@ function gen() {
 try {
     var_dump(iterator_to_array(gen()));
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -23,4 +23,4 @@ function gen() {
 Deprecated: Implicit conversion from float 2.5 to int loses precision in %s on line %d

 Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
-Cannot access offset of type array on array
+TypeError: Cannot access offset of type array on array
diff --git a/ext/spl/tests/multiple_iterator_001.phpt b/ext/spl/tests/multiple_iterator_001.phpt
index e022b54dafd..5b7f76fbd57 100644
--- a/ext/spl/tests/multiple_iterator_001.phpt
+++ b/ext/spl/tests/multiple_iterator_001.phpt
@@ -16,12 +16,12 @@
 try {
     var_dump($m->current());
 } catch (RuntimeException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($m->key());
 } catch (RuntimeException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $m->attachIterator($iter1);
@@ -38,12 +38,12 @@
 try {
     $m->current();
 } catch(RuntimeException $e) {
-    echo "RuntimeException thrown: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $m->key();
 } catch(RuntimeException $e) {
-    echo "RuntimeException thrown: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "-- Flags = MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC --\n";
@@ -71,7 +71,7 @@
 try {
     $m->current();
 } catch(InvalidArgumentException $e) {
-    echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "-- Flags |= MultipleIterator::MIT_KEYS_ASSOC --\n";
@@ -89,7 +89,7 @@
 try {
     $m->attachIterator($iter3, new stdClass());
 } catch(TypeError $e) {
-    echo "TypeError thrown: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "-- Associate with duplicate value --\n";
@@ -97,7 +97,7 @@
 try {
     $m->attachIterator($iter3, "iter1");
 } catch(InvalidArgumentException $e) {
-    echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "-- Count, contains, detach, count, contains, iterate --\n";
@@ -114,8 +114,8 @@
 ?>
 --EXPECTF--
 -- Default flags, no iterators --
-Called current() on an invalid iterator
-Called key() on an invalid iterator
+RuntimeException: Called current() on an invalid iterator
+RuntimeException: Called key() on an invalid iterator
 -- Default flags, MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC --
 bool(true)
 array(3) {
@@ -151,8 +151,8 @@
   [2]=>
   string(6) "string"
 }
-RuntimeException thrown: Called current() with non valid sub iterator
-RuntimeException thrown: Called key() with non valid sub iterator
+RuntimeException: Called current() with non valid sub iterator
+RuntimeException: Called key() with non valid sub iterator
 -- Flags = MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC --
 bool(true)
 array(3) {
@@ -255,7 +255,7 @@
   int(3)
 }
 -- Flags |= MultipleIterator::MIT_KEYS_ASSOC, with iterator associated with NULL --
-InvalidArgumentException thrown: Sub-Iterator is associated with NULL
+InvalidArgumentException: Sub-Iterator is associated with NULL
 -- Flags |= MultipleIterator::MIT_KEYS_ASSOC --
 array(3) {
   ["iter1"]=>
@@ -307,9 +307,9 @@
   int(3)
 }
 -- Associate with invalid value --
-TypeError thrown: MultipleIterator::attachIterator(): Argument #2 ($info) must be of type string|int|null, stdClass given
+TypeError: MultipleIterator::attachIterator(): Argument #2 ($info) must be of type string|int|null, stdClass given
 -- Associate with duplicate value --
-InvalidArgumentException thrown: Key duplication error
+InvalidArgumentException: Key duplication error
 -- Count, contains, detach, count, contains, iterate --
 int(3)
 bool(true)
diff --git a/ext/spl/tests/pqueue_001.phpt b/ext/spl/tests/pqueue_001.phpt
index a318487273e..fd0629b6214 100644
--- a/ext/spl/tests/pqueue_001.phpt
+++ b/ext/spl/tests/pqueue_001.phpt
@@ -8,7 +8,7 @@
 try {
     $pq->extract();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $pq->insert("a", 1);
@@ -60,7 +60,7 @@

 ?>
 --EXPECT--
-Exception: Can't extract from an empty heap
+RuntimeException: Can't extract from an empty heap
 2=>b
 1=>a
 0=>c
diff --git a/ext/spl/tests/pqueue_002.phpt b/ext/spl/tests/pqueue_002.phpt
index df4a64f4b2d..c33477e9652 100644
--- a/ext/spl/tests/pqueue_002.phpt
+++ b/ext/spl/tests/pqueue_002.phpt
@@ -18,25 +18,25 @@ public function compare($a, $b): int {
     $h->insert(3, 1);
     echo "inserted 3\n";
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     $h->insert(4, 1);
     echo "inserted 4\n";
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     var_dump($h->extract());
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($h->extract());
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Recovering..\n";
@@ -45,20 +45,20 @@ public function compare($a, $b): int {
 try {
     var_dump($h->extract());
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($h->extract());
 } catch(Exception $e) {
-    echo "Exception: ".$e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
 inserted 1
 Exception: foo
-Exception: Heap is corrupted, heap properties are no longer ensured.
-Exception: Heap is corrupted, heap properties are no longer ensured.
-Exception: Heap is corrupted, heap properties are no longer ensured.
+RuntimeException: Heap is corrupted, heap properties are no longer ensured.
+RuntimeException: Heap is corrupted, heap properties are no longer ensured.
+RuntimeException: Heap is corrupted, heap properties are no longer ensured.
 Recovering..
 int(1)
 int(2)
diff --git a/ext/spl/tests/recursive_tree_iterator_002.phpt b/ext/spl/tests/recursive_tree_iterator_002.phpt
index 01f12bf5953..6f2262dc275 100644
--- a/ext/spl/tests/recursive_tree_iterator_002.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_002.phpt
@@ -7,8 +7,8 @@
 try {
     new RecursiveTreeIterator();
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-RecursiveTreeIterator::__construct() expects at least 1 argument, 0 given
+ArgumentCountError: RecursiveTreeIterator::__construct() expects at least 1 argument, 0 given
diff --git a/ext/spl/tests/recursive_tree_iterator_003.phpt b/ext/spl/tests/recursive_tree_iterator_003.phpt
index 80225720f27..f1898206eb0 100644
--- a/ext/spl/tests/recursive_tree_iterator_003.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_003.phpt
@@ -5,8 +5,8 @@
 try {
     new RecursiveTreeIterator(new ArrayIterator(array()));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-RecursiveCachingIterator::__construct(): Argument #1 ($iterator) must be of type RecursiveIterator, ArrayIterator given
+TypeError: RecursiveCachingIterator::__construct(): Argument #1 ($iterator) must be of type RecursiveIterator, ArrayIterator given
diff --git a/ext/spl/tests/recursive_tree_iterator_007.phpt b/ext/spl/tests/recursive_tree_iterator_007.phpt
index 75f1e6386c8..996ef3fbef2 100644
--- a/ext/spl/tests/recursive_tree_iterator_007.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_007.phpt
@@ -24,7 +24,7 @@ function getIterator(): Traversable {
         echo "[$k] => $v\n";
     }
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -34,4 +34,4 @@ function getIterator(): Traversable {
 [1] => \-Array

 Deprecated: ArrayIterator::__construct(): Using an object as a backing array for ArrayIterator is deprecated, as it allows violating class constraints and invariants in %s on line %d
-Object of class stdClass could not be converted to string
+Error: Object of class stdClass could not be converted to string
diff --git a/ext/spl/tests/recursive_tree_iterator_008.phpt b/ext/spl/tests/recursive_tree_iterator_008.phpt
index 2dd53188246..339eb14635e 100644
--- a/ext/spl/tests/recursive_tree_iterator_008.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_008.phpt
@@ -21,12 +21,12 @@
 try {
     $it->setPrefixPart(-1, "");
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     $it->setPrefixPart(6, "");
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
@@ -34,5 +34,5 @@
 [0] => 0145b
 [c] => 045Array
 [0] => 0245d
-RecursiveTreeIterator::setPrefixPart(): Argument #1 ($part) must be a RecursiveTreeIterator::PREFIX_* constant
-RecursiveTreeIterator::setPrefixPart(): Argument #1 ($part) must be a RecursiveTreeIterator::PREFIX_* constant
+ValueError: RecursiveTreeIterator::setPrefixPart(): Argument #1 ($part) must be a RecursiveTreeIterator::PREFIX_* constant
+ValueError: RecursiveTreeIterator::setPrefixPart(): Argument #1 ($part) must be a RecursiveTreeIterator::PREFIX_* constant
diff --git a/ext/spl/tests/regexIterator_setMode_error.phpt b/ext/spl/tests/regexIterator_setMode_error.phpt
index 10df255f4a0..808fb2c960b 100644
--- a/ext/spl/tests/regexIterator_setMode_error.phpt
+++ b/ext/spl/tests/regexIterator_setMode_error.phpt
@@ -13,12 +13,12 @@
 try {
     $regexIterator->setMode(7);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
     var_dump($e->getCode());
 }

 ?>
 --EXPECT--
 int(0)
-RegexIterator::setMode(): Argument #1 ($mode) must be RegexIterator::MATCH, RegexIterator::GET_MATCH, RegexIterator::ALL_MATCHES, RegexIterator::SPLIT, or RegexIterator::REPLACE
+ValueError: RegexIterator::setMode(): Argument #1 ($mode) must be RegexIterator::MATCH, RegexIterator::GET_MATCH, RegexIterator::ALL_MATCHES, RegexIterator::SPLIT, or RegexIterator::REPLACE
 int(0)
diff --git a/ext/spl/tests/spl_004.phpt b/ext/spl/tests/spl_004.phpt
index 3538fa6b489..8c61739d96e 100644
--- a/ext/spl/tests/spl_004.phpt
+++ b/ext/spl/tests/spl_004.phpt
@@ -45,17 +45,17 @@ function test()
 try {
     var_dump(iterator_apply($it, 'test', 1));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(iterator_apply($it, 'non_existing_function'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(iterator_apply($it, 'non_existing_function', NULL, 2));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -84,6 +84,6 @@ function test()
 int(6)
 int(4)
 ===ERRORS===
-iterator_apply(): Argument #3 ($args) must be of type ?array, int given
-iterator_apply(): Argument #2 ($callback) must be a valid callback, function "non_existing_function" not found or invalid function name
-iterator_apply() expects at most 3 arguments, 4 given
+TypeError: iterator_apply(): Argument #3 ($args) must be of type ?array, int given
+TypeError: iterator_apply(): Argument #2 ($callback) must be a valid callback, function "non_existing_function" not found or invalid function name
+ArgumentCountError: iterator_apply() expects at most 3 arguments, 4 given
diff --git a/ext/spl/tests/spl_caching_iterator_constructor_flags.phpt b/ext/spl/tests/spl_caching_iterator_constructor_flags.phpt
index 0d107d206f4..9676ceae82c 100644
--- a/ext/spl/tests/spl_caching_iterator_constructor_flags.phpt
+++ b/ext/spl/tests/spl_caching_iterator_constructor_flags.phpt
@@ -16,10 +16,10 @@
 try {
     $test = new CachingIterator($arrayIterator, 3); // this throws an exception
 } catch (\ValueError $e){
-  print  $e->getMessage() . "\n";
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }


 ?>
 --EXPECT--
-CachingIterator::__construct(): Argument #2 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
+ValueError: CachingIterator::__construct(): Argument #2 ($flags) must contain only one of CachingIterator::CALL_TOSTRING, CachingIterator::TOSTRING_USE_KEY, CachingIterator::TOSTRING_USE_CURRENT, or CachingIterator::TOSTRING_USE_INNER
diff --git a/ext/spl/tests/spl_heap_count_basic.phpt b/ext/spl/tests/spl_heap_count_basic.phpt
index e8be968e06d..42ecd2cfc5a 100644
--- a/ext/spl/tests/spl_heap_count_basic.phpt
+++ b/ext/spl/tests/spl_heap_count_basic.phpt
@@ -26,7 +26,7 @@ public function count(): int // override count to force failure
 try {
     count($heap);// refers to MyHeap->count() method
 } catch (Exception $e) {
-    echo "Exception: " . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
diff --git a/ext/spl/tests/spl_iterator_apply_error.phpt b/ext/spl/tests/spl_iterator_apply_error.phpt
index 2a5caa00867..c047c6fc5b3 100644
--- a/ext/spl/tests/spl_iterator_apply_error.phpt
+++ b/ext/spl/tests/spl_iterator_apply_error.phpt
@@ -16,11 +16,11 @@ function test() {}
 try {
     $res = iterator_apply($it, 'test');
 } catch (Exception $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>

 <?php exit(0); ?>
 --EXPECT--
-Make the iterator break
+Exception: Make the iterator break
diff --git a/ext/spl/tests/spl_iterator_apply_error_001.phpt b/ext/spl/tests/spl_iterator_apply_error_001.phpt
index 9c021cf98fe..c4c239578eb 100644
--- a/ext/spl/tests/spl_iterator_apply_error_001.phpt
+++ b/ext/spl/tests/spl_iterator_apply_error_001.phpt
@@ -12,9 +12,9 @@ function test() {
 try {
     iterator_apply($it, 'test');
 } catch (Exception $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Broken callback
+Exception: Broken callback
diff --git a/ext/spl/tests/spl_iterator_getcallchildren.phpt b/ext/spl/tests/spl_iterator_getcallchildren.phpt
index 8a0d1cd735b..04701b5394e 100644
--- a/ext/spl/tests/spl_iterator_getcallchildren.phpt
+++ b/ext/spl/tests/spl_iterator_getcallchildren.phpt
@@ -17,7 +17,7 @@
   $output = $test->callGetChildren();
 } catch (TypeError $exception) {
   $output = null;
-  echo $exception->getMessage() . "\n";
+  echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 var_dump($output);

@@ -33,5 +33,5 @@
   int(9)
 }
 int(7)
-ArrayIterator::__construct(): Argument #1 ($array) must be of type array, int given
+TypeError: ArrayIterator::__construct(): Argument #1 ($array) must be of type array, int given
 NULL
diff --git a/ext/spl/tests/spl_iterator_iterator_constructor.phpt b/ext/spl/tests/spl_iterator_iterator_constructor.phpt
index 2349a13e316..f7ed07265e4 100644
--- a/ext/spl/tests/spl_iterator_iterator_constructor.phpt
+++ b/ext/spl/tests/spl_iterator_iterator_constructor.phpt
@@ -16,9 +16,9 @@
     $test = new IteratorIterator($arrayIterator, 1, 1, 1);
     $test = new IteratorIterator($arrayIterator, 1, 1, 1, 1);
 } catch (TypeError $e){
-  echo $e->getMessage() . "\n";
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-IteratorIterator::__construct() expects at most 2 arguments, 3 given
+ArgumentCountError: IteratorIterator::__construct() expects at most 2 arguments, 3 given
diff --git a/ext/spl/tests/spl_iterator_to_array_error.phpt b/ext/spl/tests/spl_iterator_to_array_error.phpt
index 1185f8082d2..467b6901f55 100644
--- a/ext/spl/tests/spl_iterator_to_array_error.phpt
+++ b/ext/spl/tests/spl_iterator_to_array_error.phpt
@@ -15,19 +15,19 @@ public function current(): mixed {
     // get keys
     $ar = iterator_to_array($it);
 } catch (Exception $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     // get values
     $ar = iterator_to_array($it, false);
 } catch (Exception $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>

 <?php exit(0); ?>
 --EXPECT--
-Make the iterator break
-Make the iterator break
+Exception: Make the iterator break
+Exception: Make the iterator break
diff --git a/ext/spl/tests/spl_limit_iterator_check_limits.phpt b/ext/spl/tests/spl_limit_iterator_check_limits.phpt
index 3cf4bbab175..a7c85decb1c 100644
--- a/ext/spl/tests/spl_limit_iterator_check_limits.phpt
+++ b/ext/spl/tests/spl_limit_iterator_check_limits.phpt
@@ -11,18 +11,18 @@
 try {
   $limitIterator = new LimitIterator($arrayIterator, -1);
 } catch (\ValueError $e){
-  print $e->getMessage(). "\n";
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
   $limitIterator = new LimitIterator($arrayIterator, 0, -2);
 } catch (\ValueError $e){
-  print $e->getMessage() . "\n";
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $limitIterator = new LimitIterator($arrayIterator, 0, -1);

 ?>
 --EXPECT--
-LimitIterator::__construct(): Argument #2 ($offset) must be greater than or equal to 0
-LimitIterator::__construct(): Argument #3 ($limit) must be greater than or equal to -1
+ValueError: LimitIterator::__construct(): Argument #2 ($offset) must be greater than or equal to 0
+ValueError: LimitIterator::__construct(): Argument #3 ($limit) must be greater than or equal to -1
diff --git a/ext/spl/tests/spl_pq_top_error_corrupt.phpt b/ext/spl/tests/spl_pq_top_error_corrupt.phpt
index 60f532b02fe..f8b33e37dd6 100644
--- a/ext/spl/tests/spl_pq_top_error_corrupt.phpt
+++ b/ext/spl/tests/spl_pq_top_error_corrupt.phpt
@@ -30,9 +30,9 @@ public function compare($a, $b): int {
 try {
     $priorityQueue->top();
 } catch (RuntimeException $e) {
-  echo "Exception: ".$e->getMessage().PHP_EOL;
+  echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Exception: Heap is corrupted, heap properties are no longer ensured.
+RuntimeException: Heap is corrupted, heap properties are no longer ensured.
diff --git a/ext/spl/tests/spl_pq_top_error_empty.phpt b/ext/spl/tests/spl_pq_top_error_empty.phpt
index 9e2a31bbc07..62d74f1f6f8 100644
--- a/ext/spl/tests/spl_pq_top_error_empty.phpt
+++ b/ext/spl/tests/spl_pq_top_error_empty.phpt
@@ -11,9 +11,9 @@
 try {
     $priorityQueue->top();
 } catch (RuntimeException $e) {
-    echo "Exception: ".$e->getMessage().PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-Exception: Can't peek at an empty heap
+RuntimeException: Can't peek at an empty heap
diff --git a/ext/spl/tests/unserialize_errors.phpt b/ext/spl/tests/unserialize_errors.phpt
index 64356923ae2..ee616129ac5 100644
--- a/ext/spl/tests/unserialize_errors.phpt
+++ b/ext/spl/tests/unserialize_errors.phpt
@@ -9,38 +9,38 @@
     // empty array
     unserialize('O:11:"ArrayObject":0:{}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:11:"ArrayObject":3:{i:0;b:1;i:1;a:0:{}i:2;a:0:{}}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:11:"ArrayObject":3:{i:0;i:0;i:1;a:0:{}i:2;i:0;}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:11:"ArrayObject":3:{i:0;i:0;i:1;i:0;i:2;a:0:{}}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     // iterator class name is not a string
     unserialize('O:11:"ArrayObject":4:{i:0;i:0;i:1;i:0;i:2;a:0:{}i:3;i:0;}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:11:"ArrayObject":4:{i:0;i:0;i:1;a:2:{i:0;i:1;i:1;i:2;}i:2;a:0:{}i:3;s:11:"NonExistent";}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 class Existent {}
@@ -48,7 +48,7 @@ class Existent {}
 try {
     unserialize('O:11:"ArrayObject":4:{i:0;i:0;i:1;a:2:{i:0;i:1;i:1;i:2;}i:2;a:0:{}i:3;s:8:"Existent";}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "ArrayIterator:\n";
@@ -56,25 +56,25 @@ class Existent {}
 try {
     unserialize('O:13:"ArrayIterator":0:{}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:13:"ArrayIterator":3:{i:0;b:1;i:1;a:0:{}i:2;a:0:{}}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:13:"ArrayIterator":3:{i:0;i:0;i:1;a:0:{}i:2;i:0;}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:13:"ArrayIterator":3:{i:0;i:0;i:1;i:0;i:2;a:0:{}}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "SplDoublyLinkedList:\n";
@@ -82,25 +82,25 @@ class Existent {}
 try {
     unserialize('O:19:"SplDoublyLinkedList":0:{}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:19:"SplDoublyLinkedList":3:{i:0;b:1;i:1;a:0:{}i:2;a:0:{}}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:19:"SplDoublyLinkedList":3:{i:0;i:0;i:1;a:0:{}i:2;i:0;}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:19:"SplDoublyLinkedList":3:{i:0;i:0;i:1;i:0;i:2;a:0:{}}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "SplObjectStorage:\n";
@@ -108,56 +108,56 @@ class Existent {}
 try {
     unserialize('O:16:"SplObjectStorage":0:{}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:16:"SplObjectStorage":2:{i:0;i:0;i:1;a:0:{}}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:16:"SplObjectStorage":2:{i:0;a:0:{}i:1;i:1;}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:16:"SplObjectStorage":2:{i:0;a:1:{i:0;i:0;}i:1;a:0:{}}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     unserialize('O:16:"SplObjectStorage":2:{i:0;a:2:{i:0;i:0;i:1;i:0;}i:1;a:0:{}}');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
 ArrayObject:
-Incomplete or ill-typed serialization data
-Incomplete or ill-typed serialization data
-Incomplete or ill-typed serialization data
-Passed variable is not an array or object
-Incomplete or ill-typed serialization data
-Cannot deserialize ArrayObject with iterator class 'NonExistent'; no such class exists
-Cannot deserialize ArrayObject with iterator class 'Existent'; this class is not derived from ArrayIterator
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
+InvalidArgumentException: Passed variable is not an array or object
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Cannot deserialize ArrayObject with iterator class 'NonExistent'; no such class exists
+UnexpectedValueException: Cannot deserialize ArrayObject with iterator class 'Existent'; this class is not derived from ArrayIterator
 ArrayIterator:
-Incomplete or ill-typed serialization data
-Incomplete or ill-typed serialization data
-Incomplete or ill-typed serialization data
-Passed variable is not an array or object
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
+InvalidArgumentException: Passed variable is not an array or object
 SplDoublyLinkedList:
-Incomplete or ill-typed serialization data
-Incomplete or ill-typed serialization data
-Incomplete or ill-typed serialization data
-Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
 SplObjectStorage:
-Incomplete or ill-typed serialization data
-Incomplete or ill-typed serialization data
-Incomplete or ill-typed serialization data
-Odd number of elements
-Non-object key
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Incomplete or ill-typed serialization data
+UnexpectedValueException: Odd number of elements
+UnexpectedValueException: Non-object key