Commit 1da3a6398bd for php.net

commit 1da3a6398bd12c91cb7d6b97e9b2896cdd1d588a
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date:   Tue Aug 4 19:10:07 2026 +0700

    Applied fixers to improve test robustness to extensions with no code owners (#23018)

    * ext/bz2: applied fixers to improve test robustness

    * ext/calendar: applied fixers to improve test robustness

    * ext/exif: applied fixers to improve test robustness

    * ext/fileinfo: applied fixers to improve test robustness

    * ext/filter: applied fixers to improve test robustness

    * ext/ftp: applied fixers to improve test robustness

    * ext/hash: applied fixers to improve test robustness

    * ext/iconv: applied fixers to improve test robustness

    * ext/ldap: applied fixers to improve test robustness

    * ext/pcre: applied fixers to improve test robustness

    * ext/posix: applied fixers to improve test robustness

    * ext/readline: applied fixers to improve test robustness

    * ext/shmop: applied fixers to improve test robustness

    * ext/snmp: applied fixers to improve test robustness

    * ext/sodium: applied fixers to improve test robustness

    * ext/sqlite3: applied fixers to improve test robustness

    * ext/sysvmsg: applied fixers to improve test robustness

    * ext/sysvsem: applied fixers to improve test robustness

    * ext/sysvshm: applied fixers to improve test robustness

    * ext/tidy: applied fixers to improve test robustness

    * ext/tokenizer: applied fixers to improve test robustness

    * ext/zend_test: applied fixers to improve test robustness

    * ext/zlib: applied fixers to improve test robustness

diff --git a/ext/bz2/tests/001.phpt b/ext/bz2/tests/001.phpt
index 6323a224c3a..31a8c1ea8bc 100644
--- a/ext/bz2/tests/001.phpt
+++ b/ext/bz2/tests/001.phpt
@@ -8,31 +8,31 @@
 try {
     var_dump(bzopen("", "r"));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

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

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

 try {
     var_dump(bzopen("no_such_file", "x"));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     var_dump(bzopen("no_such_file", "rw"));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 var_dump(bzopen("no_such_file", "r"));
@@ -42,11 +42,11 @@

 ?>
 --EXPECTF--
-bzopen(): Argument #1 ($file) must not be empty
-bzopen(): Argument #1 ($file) must not be empty
-bzopen(): Argument #2 ($mode) must be either "r" or "w"
-bzopen(): Argument #2 ($mode) must be either "r" or "w"
-bzopen(): Argument #2 ($mode) must be either "r" or "w"
+ValueError: bzopen(): Argument #1 ($file) must not be empty
+ValueError: bzopen(): Argument #1 ($file) must not be empty
+ValueError: bzopen(): Argument #2 ($mode) must be either "r" or "w"
+ValueError: bzopen(): Argument #2 ($mode) must be either "r" or "w"
+ValueError: bzopen(): Argument #2 ($mode) must be either "r" or "w"

 Warning: bzopen(): Failed to open stream: No such file or directory in %s on line %d
 bool(false)
diff --git a/ext/bz2/tests/002.phpt b/ext/bz2/tests/002.phpt
index 7210f90a4d9..105fa0b4f57 100644
--- a/ext/bz2/tests/002.phpt
+++ b/ext/bz2/tests/002.phpt
@@ -31,14 +31,14 @@
 try {
     var_dump(bzopen($fp, "r"));
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 $fp = fopen("bz_open_002.txt", "br");
 try {
     var_dump(bzopen($fp, "w"));
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 $fp = fopen("bz_open_002.txt", "r");
@@ -91,10 +91,10 @@
 resource(%d) of type (stream)

 Warning: fopen(): Failed to open stream: `br' is not a valid mode for fopen in %s on line %d
-bzopen(): Argument #1 ($file) must be of type string or file-resource, false given
+TypeError: bzopen(): Argument #1 ($file) must be of type string or file-resource, false given

 Warning: fopen(): Failed to open stream: `br' is not a valid mode for fopen in %s on line %d
-bzopen(): Argument #1 ($file) must be of type string or file-resource, false given
+TypeError: bzopen(): Argument #1 ($file) must be of type string or file-resource, false given

 Warning: bzopen(): cannot write to a stream opened in read only mode in %s on line %d
 bool(false)
diff --git a/ext/bz2/tests/003-mb.phpt b/ext/bz2/tests/003-mb.phpt
index 3189b473a4a..805cc150e1e 100644
--- a/ext/bz2/tests/003-mb.phpt
+++ b/ext/bz2/tests/003-mb.phpt
@@ -11,7 +11,7 @@
 try {
     var_dump(bzread($fd, -10));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 var_dump(bzread($fd, 1));
@@ -21,7 +21,7 @@
 ?>
 --EXPECT--
 string(0) ""
-bzread(): Argument #2 ($length) must be greater than or equal to 0
+ValueError: bzread(): Argument #2 ($length) must be greater than or equal to 0
 string(1) "R"
 string(2) "is"
 string(251) "ing up from the heart of the desert
diff --git a/ext/bz2/tests/003.phpt b/ext/bz2/tests/003.phpt
index 4b6ee820dd5..f737422a074 100644
--- a/ext/bz2/tests/003.phpt
+++ b/ext/bz2/tests/003.phpt
@@ -11,7 +11,7 @@
 try {
     var_dump(bzread($fd, -10));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 var_dump(bzread($fd, 1));
@@ -21,7 +21,7 @@
 ?>
 --EXPECT--
 string(0) ""
-bzread(): Argument #2 ($length) must be greater than or equal to 0
+ValueError: bzread(): Argument #2 ($length) must be greater than or equal to 0
 string(1) "R"
 string(2) "is"
 string(251) "ing up from the heart of the desert
diff --git a/ext/bz2/tests/004.phpt b/ext/bz2/tests/004.phpt
index 240cef37a17..910aa067f6b 100644
--- a/ext/bz2/tests/004.phpt
+++ b/ext/bz2/tests/004.phpt
@@ -39,22 +39,22 @@
 try {
     var_dump(bzread($fd2));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(bzerror($fd2));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(bzerrstr($fd2));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(bzerrno($fd2));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Done\n";
@@ -112,8 +112,8 @@
 }
 string(10) "DATA_ERROR"
 int(-4)
-bzread(): Argument #1 ($bz) must be an open stream resource
-bzerror(): Argument #1 ($bz) must be an open stream resource
-bzerrstr(): Argument #1 ($bz) must be an open stream resource
-bzerrno(): Argument #1 ($bz) must be an open stream resource
+TypeError: bzread(): Argument #1 ($bz) must be an open stream resource
+TypeError: bzerror(): Argument #1 ($bz) must be an open stream resource
+TypeError: bzerrstr(): Argument #1 ($bz) must be an open stream resource
+TypeError: bzerrno(): Argument #1 ($bz) must be an open stream resource
 Done
diff --git a/ext/bz2/tests/bzerr_functions_on_invalid_stream.phpt b/ext/bz2/tests/bzerr_functions_on_invalid_stream.phpt
index a9fd3a21186..03b8e09c654 100644
--- a/ext/bz2/tests/bzerr_functions_on_invalid_stream.phpt
+++ b/ext/bz2/tests/bzerr_functions_on_invalid_stream.phpt
@@ -8,20 +8,20 @@
 try {
     var_dump(bzerrno($f));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(bzerrstr($f));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(bzerror($f));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bzerrno(): Argument #1 ($bz) must be a bz2 stream
-bzerrstr(): Argument #1 ($bz) must be a bz2 stream
-bzerror(): Argument #1 ($bz) must be a bz2 stream
+TypeError: bzerrno(): Argument #1 ($bz) must be a bz2 stream
+TypeError: bzerrstr(): Argument #1 ($bz) must be a bz2 stream
+TypeError: bzerror(): Argument #1 ($bz) must be a bz2 stream
diff --git a/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt b/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt
index b76515a178d..6f47c2fa237 100644
--- a/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt
+++ b/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt
@@ -8,16 +8,16 @@
 try {
     bzopen("file\0", "w");
 } catch (TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     bzopen("file\0", "r");
 } catch (TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-bzopen(): Argument #1 ($file) must not contain null bytes
-bzopen(): Argument #1 ($file) must not contain null bytes
+TypeError: bzopen(): Argument #1 ($file) must not contain null bytes
+TypeError: bzopen(): Argument #1 ($file) must not contain null bytes
diff --git a/ext/calendar/tests/bug80185.phpt b/ext/calendar/tests/bug80185.phpt
index d52f9696a17..44b9df86ac0 100644
--- a/ext/calendar/tests/bug80185.phpt
+++ b/ext/calendar/tests/bug80185.phpt
@@ -13,10 +13,10 @@
 try {
     var_dump(jdtounix((int)(PHP_INT_MAX / 86400 + 2440589)));
 } catch (ValueError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
 int(2170713600)
 int(9223372036854720000)
-jday must be between 2440588 and 106751993607888
+ValueError: jday must be between 2440588 and 106751993607888
diff --git a/ext/calendar/tests/cal_days_in_month_error1.phpt b/ext/calendar/tests/cal_days_in_month_error1.phpt
index e110c13cc2a..dcf7db51ec0 100644
--- a/ext/calendar/tests/cal_days_in_month_error1.phpt
+++ b/ext/calendar/tests/cal_days_in_month_error1.phpt
@@ -9,14 +9,14 @@
 try {
     cal_days_in_month(-1, 4, 2017);
 } catch (ValueError $ex) {
-    echo "{$ex->getMessage()}\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try{
     cal_days_in_month(CAL_GREGORIAN,20, 2009);
 } catch (ValueError $ex) {
-    echo "{$ex->getMessage()}\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-cal_days_in_month(): Argument #1 ($calendar) must be a valid calendar ID
-Invalid date
+ValueError: cal_days_in_month(): Argument #1 ($calendar) must be a valid calendar ID
+ValueError: Invalid date
diff --git a/ext/calendar/tests/cal_from_jd_error1.phpt b/ext/calendar/tests/cal_from_jd_error1.phpt
index 3b4e11b8350..80731b86764 100644
--- a/ext/calendar/tests/cal_from_jd_error1.phpt
+++ b/ext/calendar/tests/cal_from_jd_error1.phpt
@@ -9,8 +9,8 @@
 try {
     cal_from_jd(1748326, -1);
 } catch (ValueError $ex) {
-    echo "{$ex->getMessage()}\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-cal_from_jd(): Argument #2 ($calendar) must be a valid calendar ID
+ValueError: cal_from_jd(): Argument #2 ($calendar) must be a valid calendar ID
diff --git a/ext/calendar/tests/cal_info.phpt b/ext/calendar/tests/cal_info.phpt
index 18884917e53..1990c1ccbd6 100644
--- a/ext/calendar/tests/cal_info.phpt
+++ b/ext/calendar/tests/cal_info.phpt
@@ -11,7 +11,7 @@
   try {
       cal_info(99999);
   } catch (ValueError $ex) {
-      echo "{$ex->getMessage()}\n";
+      echo $ex::class, ': ', $ex->getMessage(), "\n";
   }
 ?>
 --EXPECT--
@@ -216,4 +216,4 @@
     [calname] => Julian
     [calsymbol] => CAL_JULIAN
 )
-cal_info(): Argument #1 ($calendar) must be a valid calendar ID
+ValueError: cal_info(): Argument #1 ($calendar) must be a valid calendar ID
diff --git a/ext/calendar/tests/cal_to_jd_error1.phpt b/ext/calendar/tests/cal_to_jd_error1.phpt
index 1cef36af69f..18ab699de1d 100644
--- a/ext/calendar/tests/cal_to_jd_error1.phpt
+++ b/ext/calendar/tests/cal_to_jd_error1.phpt
@@ -9,8 +9,8 @@
 try {
     cal_to_jd(-1, 8, 26, 74);
 } catch (ValueError $ex) {
-    echo "{$ex->getMessage()}\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-cal_to_jd(): Argument #1 ($calendar) must be a valid calendar ID
+ValueError: cal_to_jd(): Argument #1 ($calendar) must be a valid calendar ID
diff --git a/ext/calendar/tests/easter_date_64bit.phpt b/ext/calendar/tests/easter_date_64bit.phpt
index 3939b7e4a4d..f6d97ba9f20 100644
--- a/ext/calendar/tests/easter_date_64bit.phpt
+++ b/ext/calendar/tests/easter_date_64bit.phpt
@@ -20,14 +20,14 @@
 try {
     easter_date(1492);
 } catch (ValueError $ex) {
-    echo "{$ex->getMessage()}\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-2000-04-23
-2001-04-15
-2002-03-31
-2045-04-09
-2046-03-25
-2047-04-14
-easter_date(): Argument #1 ($year) must be a year after 1970 (inclusive)
+2000-04-23
+2001-04-15
+2002-03-31
+2045-04-09
+2046-03-25
+2047-04-14
+ValueError: easter_date(): Argument #1 ($year) must be a year after 1970 (inclusive)
diff --git a/ext/calendar/tests/easter_date_checks_upper_bound_64bit.phpt b/ext/calendar/tests/easter_date_checks_upper_bound_64bit.phpt
index 2c7afbdfa2d..c2177673ffe 100644
--- a/ext/calendar/tests/easter_date_checks_upper_bound_64bit.phpt
+++ b/ext/calendar/tests/easter_date_checks_upper_bound_64bit.phpt
@@ -14,8 +14,8 @@
 try {
     easter_date(293274701009);
 } catch (ValueError $ex) {
-    echo "{$ex->getMessage()}\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-easter_date(): Argument #1 ($year) must be a year before 2.000.000.000 (inclusive)
+ValueError: easter_date(): Argument #1 ($year) must be a year before 2.000.000.000 (inclusive)
diff --git a/ext/calendar/tests/gh16228.phpt b/ext/calendar/tests/gh16228.phpt
index 9ce80688195..0699152566f 100644
--- a/ext/calendar/tests/gh16228.phpt
+++ b/ext/calendar/tests/gh16228.phpt
@@ -7,20 +7,20 @@
 try {
 	easter_days(PHP_INT_MAX, 0);
 } catch (\ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
 	easter_days(-1, 0);
 } catch (\ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
 	easter_date(PHP_INT_MAX, 0);
 } catch (\ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-easter_days(): Argument #1 ($year) must be between 1 and %d
-easter_days(): Argument #1 ($year) must be between 1 and %d
-easter_date(): Argument #1 ($year) must be between 1 and %d
+ValueError: easter_days(): Argument #1 ($year) must be between 1 and %d
+ValueError: easter_days(): Argument #1 ($year) must be between 1 and %d
+ValueError: easter_date(): Argument #1 ($year) must be between 1 and %d
diff --git a/ext/calendar/tests/gh16231.phpt b/ext/calendar/tests/gh16231.phpt
index 89b09dd3f63..d003f38b1f0 100644
--- a/ext/calendar/tests/gh16231.phpt
+++ b/ext/calendar/tests/gh16231.phpt
@@ -7,15 +7,15 @@
 try {
 	jdtounix(PHP_INT_MIN);
 } catch (\ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	jdtounix(240587);
 } catch (\ValueError $e) {
-	echo $e->getMessage();
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-jday must be between 2440588 and %d
-jday must be between 2440588 and %d
+ValueError: jday must be between 2440588 and %d
+ValueError: jday must be between 2440588 and %d
diff --git a/ext/calendar/tests/gh16234_2_64.phpt b/ext/calendar/tests/gh16234_2_64.phpt
index 7da25460965..166e67a0efa 100644
--- a/ext/calendar/tests/gh16234_2_64.phpt
+++ b/ext/calendar/tests/gh16234_2_64.phpt
@@ -13,9 +13,8 @@
 try {
 	jewishtojd(10, 6, PHP_INT_MIN);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-jewishtojd(): Argument #3 ($year) must be between %i and %d
-
+ValueError: jewishtojd(): Argument #3 ($year) must be between %i and %d
diff --git a/ext/calendar/tests/gh19371.phpt b/ext/calendar/tests/gh19371.phpt
index 1d807a98388..b2b4837851c 100644
--- a/ext/calendar/tests/gh19371.phpt
+++ b/ext/calendar/tests/gh19371.phpt
@@ -10,52 +10,52 @@
 try {
     echo cal_days_in_month(CAL_GREGORIAN, 12, PHP_INT_MAX);
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     echo cal_days_in_month(CAL_GREGORIAN, PHP_INT_MIN, 1);
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     echo cal_days_in_month(CAL_GREGORIAN, PHP_INT_MAX, 1);
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     echo cal_to_jd(CAL_GREGORIAN, PHP_INT_MIN, 1, 1);
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     echo cal_to_jd(CAL_GREGORIAN, PHP_INT_MAX, 1, 1);
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     echo cal_to_jd(CAL_GREGORIAN, 1, PHP_INT_MIN, 1);
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     echo cal_to_jd(CAL_GREGORIAN, 1, PHP_INT_MAX, 1);
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     echo cal_to_jd(CAL_GREGORIAN, 1, 1, PHP_INT_MAX);
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-cal_days_in_month(): Argument #3 ($year) must be less than 2147483646
-cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646
-cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646
-cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646
-cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646
-cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647
-cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647
-cal_to_jd(): Argument #4 ($year) must be less than 2147483646
+ValueError: cal_days_in_month(): Argument #3 ($year) must be less than 2147483646
+ValueError: cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646
+ValueError: cal_days_in_month(): Argument #2 ($month) must be between 1 and 2147483646
+ValueError: cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646
+ValueError: cal_to_jd(): Argument #2 ($month) must be between 1 and 2147483646
+ValueError: cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647
+ValueError: cal_to_jd(): Argument #3 ($day) must be between -2147483648 and 2147483647
+ValueError: cal_to_jd(): Argument #4 ($year) must be less than 2147483646
diff --git a/ext/calendar/tests/jdtojewish.phpt b/ext/calendar/tests/jdtojewish.phpt
index 6b1c2e3f775..ba40a2056da 100644
--- a/ext/calendar/tests/jdtojewish.phpt
+++ b/ext/calendar/tests/jdtojewish.phpt
@@ -23,7 +23,7 @@
 try {
     jdtojewish(gregoriantojd(1,1,9998),true);
 } catch (ValueError $ex) {
-    echo "{$ex->getMessage()}\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
@@ -42,4 +42,4 @@
 2/30/5763
 3/16/5765
 3/8/13758
-Year out of range (0-9999)
+ValueError: Year out of range (0-9999)
diff --git a/ext/calendar/tests/jdtojewish_hebrew.phpt b/ext/calendar/tests/jdtojewish_hebrew.phpt
index ceb53c219e7..3909162e1bf 100644
--- a/ext/calendar/tests/jdtojewish_hebrew.phpt
+++ b/ext/calendar/tests/jdtojewish_hebrew.phpt
@@ -46,4 +46,3 @@
 e020faeee5e620e4e0
 e020e0e120e4e0
 e020e0ece5ec20e4e0
-
diff --git a/ext/calendar/tests/jdtounix_error1.phpt b/ext/calendar/tests/jdtounix_error1.phpt
index 0032e376db3..adad98947dc 100644
--- a/ext/calendar/tests/jdtounix_error1.phpt
+++ b/ext/calendar/tests/jdtounix_error1.phpt
@@ -11,8 +11,8 @@
 try {
     jdtounix(2440579);
 } catch (ValueError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-jday must be between 2440588 and %d
+ValueError: jday must be between 2440588 and %d
diff --git a/ext/calendar/tests/unixtojd_error1.phpt b/ext/calendar/tests/unixtojd_error1.phpt
index 171d400b99e..a17a5b291a0 100644
--- a/ext/calendar/tests/unixtojd_error1.phpt
+++ b/ext/calendar/tests/unixtojd_error1.phpt
@@ -13,12 +13,12 @@
 try {
     unixtojd(-1);
 } catch (ValueError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }
 var_dump(unixtojd(null)) . PHP_EOL;
 var_dump(unixtojd(time())) . PHP_EOL;
 ?>
 --EXPECTF--
-unixtojd(): Argument #1 ($timestamp) must be greater than or equal to 0
+ValueError: unixtojd(): Argument #1 ($timestamp) must be greater than or equal to 0
 int(%d)
 int(%d)
diff --git a/ext/exif/tests/bug77540.phpt b/ext/exif/tests/bug77540.phpt
index 397e9f8223b..92a5927068f 100644
--- a/ext/exif/tests/bug77540.phpt
+++ b/ext/exif/tests/bug77540.phpt
@@ -13,4 +13,4 @@
 --EXPECT--
 Width 0
 Height 0
-DONE
\ No newline at end of file
+DONE
diff --git a/ext/exif/tests/bug77831.phpt b/ext/exif/tests/bug77831.phpt
index 5f29581d11c..1490b2d6606 100644
--- a/ext/exif/tests/bug77831.phpt
+++ b/ext/exif/tests/bug77831.phpt
@@ -10,4 +10,4 @@
 --EXPECTF--
 %A
 bool(false)
-DONE
\ No newline at end of file
+DONE
diff --git a/ext/exif/tests/bug77950.phpt b/ext/exif/tests/bug77950.phpt
index bccd9ec3e2c..7361ff596a6 100644
--- a/ext/exif/tests/bug77950.phpt
+++ b/ext/exif/tests/bug77950.phpt
@@ -9,4 +9,4 @@
 DONE
 --EXPECTF--
 %A
-DONE
\ No newline at end of file
+DONE
diff --git a/ext/exif/tests/filename_empty.phpt b/ext/exif/tests/filename_empty.phpt
index 753a7c6acd0..89b16cda0af 100644
--- a/ext/exif/tests/filename_empty.phpt
+++ b/ext/exif/tests/filename_empty.phpt
@@ -8,30 +8,30 @@
 try {
     exif_read_data("");
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

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

 try {
     exif_read_data("foo\0bar");
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     exif_thumbnail("foo\0bar");
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-exif_read_data(): Argument #1 ($file) must not be empty
-exif_thumbnail(): Argument #1 ($file) must not be empty
-exif_read_data(): Argument #1 ($file) must not contain any null bytes
-exif_thumbnail(): Argument #1 ($file) must not contain any null bytes
+ValueError: exif_read_data(): Argument #1 ($file) must not be empty
+ValueError: exif_thumbnail(): Argument #1 ($file) must not be empty
+ValueError: exif_read_data(): Argument #1 ($file) must not contain any null bytes
+ValueError: exif_thumbnail(): Argument #1 ($file) must not contain any null bytes
diff --git a/ext/fileinfo/tests/bug61173.phpt b/ext/fileinfo/tests/bug61173.phpt
index e135f909333..9d18dc8bcf5 100644
--- a/ext/fileinfo/tests/bug61173.phpt
+++ b/ext/fileinfo/tests/bug61173.phpt
@@ -9,8 +9,8 @@
     $finfo = new finfo(1, '', false);
     var_dump($finfo);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-finfo::__construct() expects at most 2 arguments, 3 given
+ArgumentCountError: finfo::__construct() expects at most 2 arguments, 3 given
diff --git a/ext/fileinfo/tests/clone_serialize.phpt b/ext/fileinfo/tests/clone_serialize.phpt
index 768cccfff39..7a63d04908a 100644
--- a/ext/fileinfo/tests/clone_serialize.phpt
+++ b/ext/fileinfo/tests/clone_serialize.phpt
@@ -11,17 +11,17 @@
     $finfo2 = clone $finfo;
     var_dump($finfo2->buffer("Test string"));
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $finfo3 = unserialize(serialize($finfo));
     var_dump($finfo3->buffer("Test string"));
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
 string(%d) "%s"
-Trying to clone an uncloneable object of class finfo
-Serialization of 'finfo' is not allowed
+Error: Trying to clone an uncloneable object of class finfo
+Exception: Serialization of 'finfo' is not allowed
diff --git a/ext/fileinfo/tests/finfo_close_error.phpt b/ext/fileinfo/tests/finfo_close_error.phpt
index c7873b46272..798adb7e4da 100644
--- a/ext/fileinfo/tests/finfo_close_error.phpt
+++ b/ext/fileinfo/tests/finfo_close_error.phpt
@@ -11,7 +11,7 @@
 try {
     var_dump( finfo_close( $fp ) );
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -21,4 +21,4 @@
 -- Testing finfo_close() function with wrong resource type --

 Deprecated: Function finfo_close() is deprecated since 8.5, as finfo objects are freed automatically in %s on line %d
-finfo_close(): Argument #1 ($finfo) must be of type finfo, resource given
+TypeError: finfo_close(): Argument #1 ($finfo) must be of type finfo, resource given
diff --git a/ext/fileinfo/tests/finfo_file_001.phpt b/ext/fileinfo/tests/finfo_file_001.phpt
index 91b9b69717f..184eee77633 100644
--- a/ext/fileinfo/tests/finfo_file_001.phpt
+++ b/ext/fileinfo/tests/finfo_file_001.phpt
@@ -9,20 +9,20 @@
 try {
     var_dump(finfo_file($fp, "\0"));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     var_dump(finfo_file($fp, ''));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 var_dump(finfo_file($fp, '.'));
 var_dump(finfo_file($fp, '&'));

 ?>
 --EXPECTF--
-finfo_file(): Argument #2 ($filename) must not contain any null bytes
-finfo_file(): Argument #2 ($filename) must not be empty
+ValueError: finfo_file(): Argument #2 ($filename) must not contain any null bytes
+ValueError: finfo_file(): Argument #2 ($filename) must not be empty
 string(9) "directory"

 Warning: finfo_file(): Failed to open stream: No such file or directory in %s on line %d
diff --git a/ext/fileinfo/tests/finfo_file_basic.phpt b/ext/fileinfo/tests/finfo_file_basic.phpt
index 4545a3063a7..9348dea3307 100644
--- a/ext/fileinfo/tests/finfo_file_basic.phpt
+++ b/ext/fileinfo/tests/finfo_file_basic.phpt
@@ -16,7 +16,7 @@
 try {
     var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
@@ -25,4 +25,4 @@
 string(28) "text/x-php; charset=us-ascii"
 string(22) "PHP script, ASCII text"
 string(29) "text/x-file; charset=us-ascii"
-finfo_file(): Argument #2 ($filename) must not contain any null bytes
+ValueError: finfo_file(): Argument #2 ($filename) must not contain any null bytes
diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt
index 2ed7168e90d..2ee999113b9 100644
--- a/ext/fileinfo/tests/finfo_open_001.phpt
+++ b/ext/fileinfo/tests/finfo_open_001.phpt
@@ -7,7 +7,7 @@
 try {
     var_dump(finfo_open(FILEINFO_MIME, "\0"));
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 var_dump(finfo_open(FILEINFO_MIME, NULL));
@@ -22,23 +22,23 @@
 try {
     var_dump($obj = new finfo(FILEINFO_MIME, 123));
 } catch (\Exception $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     var_dump($obj = new finfo(FILEINFO_MIME, 1.0));
 } catch (\Exception $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     var_dump($obj = new finfo(FILEINFO_MIME, '/foo/bar/inexistent'));
 } catch (\Exception $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-finfo_open(): Argument #2 ($magic_database) must not contain any null bytes
+ValueError: finfo_open(): Argument #2 ($magic_database) must not contain any null bytes
 object(finfo)#%d (0) {
 }
 object(finfo)#%d (0) {
@@ -68,6 +68,6 @@
 }
 object(finfo)#%d (%d) {
 }
-finfo::__construct(): Failed to open stream: No such file or directory
-finfo::__construct(): Failed to open stream: No such file or directory
-finfo::__construct(): Failed to open stream: No such file or directory
+Exception: finfo::__construct(): Failed to open stream: No such file or directory
+Exception: finfo::__construct(): Failed to open stream: No such file or directory
+Exception: finfo::__construct(): Failed to open stream: No such file or directory
diff --git a/ext/fileinfo/tests/finfo_open_003.phpt b/ext/fileinfo/tests/finfo_open_003.phpt
index 39a45a61c6f..7e464c3d39c 100644
--- a/ext/fileinfo/tests/finfo_open_003.phpt
+++ b/ext/fileinfo/tests/finfo_open_003.phpt
@@ -11,9 +11,9 @@
 try {
     $object = new finfo(FILEINFO_MIME, $buggyPath);
 } catch (\Exception $ex) {
-    echo "TEST:" . $ex->getMessage() . PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
 bool(false)
-TEST:Constructor failed
+Exception: Constructor failed
diff --git a/ext/fileinfo/tests/finfo_open_004.phpt b/ext/fileinfo/tests/finfo_open_004.phpt
index ff911bc7508..06f7858cb24 100644
--- a/ext/fileinfo/tests/finfo_open_004.phpt
+++ b/ext/fileinfo/tests/finfo_open_004.phpt
@@ -13,10 +13,10 @@
 try {
     $object = new finfo(FILEINFO_MIME, $buggyPath);
 } catch (\Exception $ex) {
-    echo "TEST:" . $ex->getMessage() . PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
 Warning: finfo_open(): File name is longer than the maximum allowed path length on this platform (%d): %s in %s on line %d
 bool(false)
-TEST:finfo::__construct(): File name is longer than the maximum allowed path length on this platform (%d): %s
+Exception: finfo::__construct(): File name is longer than the maximum allowed path length on this platform (%d): %s
diff --git a/ext/fileinfo/tests/finfo_open_error.phpt b/ext/fileinfo/tests/finfo_open_error.phpt
index 7c6fc976637..c48230b7aa2 100644
--- a/ext/fileinfo/tests/finfo_open_error.phpt
+++ b/ext/fileinfo/tests/finfo_open_error.phpt
@@ -14,13 +14,13 @@
 try {
     var_dump( finfo_open( 'foobar' ) );
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     var_dump( new finfo('foobar') );
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -37,5 +37,5 @@
 Warning: finfo_open(): using regular magic file `%smagic' in %sfinfo_open_error.php on line %d
 object(finfo)#%d (0) {
 }
-finfo_open(): Argument #1 ($flags) must be of type int, string given
-finfo::__construct(): Argument #1 ($flags) must be of type int, string given
+TypeError: finfo_open(): Argument #1 ($flags) must be of type int, string given
+TypeError: finfo::__construct(): Argument #1 ($flags) must be of type int, string given
diff --git a/ext/fileinfo/tests/finfo_uninitialized.phpt b/ext/fileinfo/tests/finfo_uninitialized.phpt
index 533574c9c0d..9aba6719414 100644
--- a/ext/fileinfo/tests/finfo_uninitialized.phpt
+++ b/ext/fileinfo/tests/finfo_uninitialized.phpt
@@ -10,37 +10,37 @@
 try {
 	var_dump(finfo_set_flags($finfo, FILEINFO_NONE));
 } catch (Error $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	var_dump($finfo->set_flags(FILEINFO_NONE));
 } catch (Error $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	var_dump(finfo_file($finfo, __FILE__));
 } catch (Error $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	var_dump($finfo->file(__FILE__));
 } catch (Error $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	var_dump(finfo_buffer($finfo, file_get_contents(__FILE__)));
 } catch (Error $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	var_dump($finfo->file(file_get_contents(__FILE__)));
 } catch (Error $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
diff --git a/ext/fileinfo/tests/gh18267.phpt b/ext/fileinfo/tests/gh18267.phpt
index ba7647288d1..a33a51775a8 100644
--- a/ext/fileinfo/tests/gh18267.phpt
+++ b/ext/fileinfo/tests/gh18267.phpt
@@ -8,7 +8,7 @@
 try {
     $cls->file("test",FILEINFO_NONE, STDERR);
 } catch (\TypeError $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 --EXPECT--
-finfo::file(): supplied resource is not a valid Stream-Context resource
+TypeError: finfo::file(): supplied resource is not a valid Stream-Context resource
diff --git a/ext/fileinfo/tests/mime_content_type_001.phpt b/ext/fileinfo/tests/mime_content_type_001.phpt
index 93b14576814..74e22de59aa 100644
--- a/ext/fileinfo/tests/mime_content_type_001.phpt
+++ b/ext/fileinfo/tests/mime_content_type_001.phpt
@@ -8,22 +8,22 @@
 try {
     mime_content_type(1);
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     mime_content_type(NULL);
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     mime_content_type(new stdclass);
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     mime_content_type(array());
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 mime_content_type('foo/inexistent');
@@ -31,21 +31,21 @@
 try {
     mime_content_type('');
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     mime_content_type("\0");
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECTF--
-mime_content_type(): Argument #1 ($filename) must be of type resource|string, int given
-mime_content_type(): Argument #1 ($filename) must be of type resource|string, null given
-mime_content_type(): Argument #1 ($filename) must be of type resource|string, stdClass given
-mime_content_type(): Argument #1 ($filename) must be of type resource|string, array given
+TypeError: mime_content_type(): Argument #1 ($filename) must be of type resource|string, int given
+TypeError: mime_content_type(): Argument #1 ($filename) must be of type resource|string, null given
+TypeError: mime_content_type(): Argument #1 ($filename) must be of type resource|string, stdClass given
+TypeError: mime_content_type(): Argument #1 ($filename) must be of type resource|string, array given

 Warning: mime_content_type(): Failed to open stream: No such file or directory in %s on line %d
-mime_content_type(): Argument #1 ($filename) must not be empty
-mime_content_type(): Argument #1 ($filename) must not contain any null bytes
+ValueError: mime_content_type(): Argument #1 ($filename) must not be empty
+TypeError: mime_content_type(): Argument #1 ($filename) must not contain any null bytes
diff --git a/ext/filter/tests/011.phpt b/ext/filter/tests/011.phpt
index 772fdf6b5ec..008967099f7 100644
--- a/ext/filter/tests/011.phpt
+++ b/ext/filter/tests/011.phpt
@@ -16,7 +16,7 @@
 try {
     filter_input(INPUT_GET, "b", FILTER_VALIDATE_FLOAT, new stdClass);
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_FLOAT));
 var_dump(filter_input(INPUT_POST, "c", FILTER_SANITIZE_SPECIAL_CHARS));
@@ -27,7 +27,7 @@
 --EXPECT--
 string(18) "http://example.com"
 string(27) "&#60;b&#62;test&#60;/b&#62;"
-filter_input(): Argument #4 ($options) must be of type array|int, stdClass given
+TypeError: filter_input(): Argument #4 ($options) must be of type array|int, stdClass given
 float(12345.7)
 string(29) "&#60;p&#62;string&#60;/p&#62;"
 bool(false)
diff --git a/ext/filter/tests/017.phpt b/ext/filter/tests/017.phpt
index e37177c60d6..9d2e702b4c7 100644
--- a/ext/filter/tests/017.phpt
+++ b/ext/filter/tests/017.phpt
@@ -13,7 +13,7 @@
 try {
     filter_var("data", FILTER_VALIDATE_REGEXP);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 echo "Done\n";
@@ -24,5 +24,5 @@
 string(4) "data"
 bool(false)
 bool(false)
-filter_var(): "regexp" option is missing
+ValueError: filter_var(): "regexp" option is missing
 Done
diff --git a/ext/filter/tests/029.phpt b/ext/filter/tests/029.phpt
index ca4feb2e4ae..44415e06b09 100644
--- a/ext/filter/tests/029.phpt
+++ b/ext/filter/tests/029.phpt
@@ -17,19 +17,19 @@ function test($var) {
 try {
     filter_var("qwe", FILTER_CALLBACK, array("options"=>"no such func"));
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     filter_var("qwe", FILTER_CALLBACK, array("options"=>""));
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

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

 /* Simple class method callback */
@@ -68,7 +68,7 @@ function test3($var) {
 try {
     var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test3")));
 } catch (Exception $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Done\n";
@@ -77,9 +77,9 @@ function test3($var) {
 string(4) "DATA"
 string(46) "~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?"}{:"
 string(0) ""
-filter_var(): Option must be a valid callback
-filter_var(): Option must be a valid callback
-filter_var(): Option must be a valid callback
+TypeError: filter_var(): Option must be a valid callback
+TypeError: filter_var(): Option must be a valid callback
+TypeError: filter_var(): Option must be a valid callback
 string(4) "data"
 string(46) "~!@#$%^&*()_qwertyuiopasdfghjklzxcvbnm<>>?"}{:"
 string(0) ""
@@ -95,5 +95,5 @@ function test3($var) {

 Warning: test2(): Argument #1 ($var) must be passed by reference, value given in %s on line %d
 NULL
-string(4) "test"
+Exception: test
 Done
diff --git a/ext/filter/tests/031.phpt b/ext/filter/tests/031.phpt
index 70117fa025a..eb930642d18 100644
--- a/ext/filter/tests/031.phpt
+++ b/ext/filter/tests/031.phpt
@@ -36,7 +36,7 @@
     try {
         var_dump(filter_var($float, FILTER_VALIDATE_FLOAT, array("options"=>array('decimal' => $dec))));
     } catch (ValueError $exception) {
-        echo $exception->getMessage() . "\n";
+        echo $exception::class, ': ', $exception->getMessage(), "\n";
     }
 }

@@ -55,5 +55,5 @@
 bool(false)
 float(1.234)
 float(1.234)
-filter_var(): "decimal" option must be one character long
+ValueError: filter_var(): "decimal" option must be one character long
 bool(false)
diff --git a/ext/filter/tests/039.phpt b/ext/filter/tests/039.phpt
index 229feecd447..22a7170c05d 100644
--- a/ext/filter/tests/039.phpt
+++ b/ext/filter/tests/039.phpt
@@ -14,7 +14,7 @@
 try {
     filter_var_array(array(), "");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 echo "-- (2)\n";
@@ -24,7 +24,7 @@
 try {
     filter_var_array(array(""=>""), "");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 echo "-- (3)\n";
@@ -34,7 +34,7 @@
 try {
     filter_var_array(array("aaa"=>"bbb"), "");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 echo "-- (4)\n";
@@ -42,7 +42,7 @@
 try {
     filter_var_array(array(), new stdclass);
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 var_dump(filter_var_array(array(), array()));
@@ -54,12 +54,12 @@
 try {
     filter_var_array(array("var_name"=>""), array("var_name"=>-1, "asdas"=>"asdasd", "qwe"=>"rty", ""=>""));
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 try {
     filter_var_array(array("asdas"=>"text"), array("var_name"=>-1, "asdas"=>"asdasd", "qwe"=>"rty", ""=>""));
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 $a = array(""=>""); $b = -1;
@@ -74,7 +74,7 @@
 try {
     filter_var_array($a, $b);
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 var_dump($a, $b);

@@ -96,7 +96,7 @@

 Warning: filter_var_array(): Unknown filter with ID 1000000 in %s on line %d
 bool(false)
-filter_var_array(): Argument #2 ($options) must be of type array|int, string given
+TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, string given
 -- (2)

 Warning: filter_var_array(): Unknown filter with ID -1 in %s on line %d
@@ -104,7 +104,7 @@

 Warning: filter_var_array(): Unknown filter with ID 1000000 in %s on line %d
 bool(false)
-filter_var_array(): Argument #2 ($options) must be of type array|int, string given
+TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, string given
 -- (3)

 Warning: filter_var_array(): Unknown filter with ID -1 in %s on line %d
@@ -112,9 +112,9 @@

 Warning: filter_var_array(): Unknown filter with ID 1000000 in %s on line %d
 bool(false)
-filter_var_array(): Argument #2 ($options) must be of type array|int, string given
+TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, string given
 -- (4)
-filter_var_array(): Argument #2 ($options) must be of type array|int, stdClass given
+TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, stdClass given
 array(0) {
 }
 array(1) {
@@ -134,10 +134,10 @@
 -- (5)

 Warning: filter_var_array(): Unknown filter with ID -1 in %s on line %d
-filter_var_array(): Argument #2 ($options) cannot contain empty keys
+ValueError: filter_var_array(): Argument #2 ($options) cannot contain empty keys

 Warning: filter_var_array(): Unknown filter with ID 0 in %s on line %d
-filter_var_array(): Argument #2 ($options) cannot contain empty keys
+ValueError: filter_var_array(): Argument #2 ($options) cannot contain empty keys

 Warning: filter_var_array(): Unknown filter with ID -1 in %s on line %d
 bool(false)
@@ -154,7 +154,7 @@
   string(0) ""
 }
 int(100000)
-filter_var_array(): Argument #2 ($options) must be of type array|int, string given
+TypeError: filter_var_array(): Argument #2 ($options) must be of type array|int, string given
 array(1) {
   [""]=>
   string(0) ""
diff --git a/ext/filter/tests/040.phpt b/ext/filter/tests/040.phpt
index 316088ff31c..ff4eedf63b6 100644
--- a/ext/filter/tests/040.phpt
+++ b/ext/filter/tests/040.phpt
@@ -19,7 +19,7 @@
 try {
     filter_has_var(-1, "cc");
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 var_dump(filter_has_var(0, "cc"));
@@ -34,6 +34,6 @@
 bool(true)
 bool(false)
 bool(false)
-filter_has_var(): Argument #1 ($input_type) must be an INPUT_* constant
+ValueError: filter_has_var(): Argument #1 ($input_type) must be an INPUT_* constant
 bool(false)
 Done
diff --git a/ext/filter/tests/055.phpt b/ext/filter/tests/055.phpt
index f058db064b0..23241b76ae9 100644
--- a/ext/filter/tests/055.phpt
+++ b/ext/filter/tests/055.phpt
@@ -24,7 +24,7 @@
     try {
         var_dump(filter_var($value[0], FILTER_VALIDATE_MAC, $value[1]));
     } catch (ValueError $exception) {
-        echo $exception->getMessage() . "\n";
+        echo $exception::class, ': ', $exception->getMessage(), "\n";
     }
 }

@@ -43,6 +43,6 @@
 bool(false)
 bool(false)
 string(14) "0123.4567.89ab"
-filter_var(): "separator" option must be one character long
-filter_var(): "separator" option must be one character long
+ValueError: filter_var(): "separator" option must be one character long
+ValueError: filter_var(): "separator" option must be one character long
 Done
diff --git a/ext/filter/tests/bug51368.phpt b/ext/filter/tests/bug51368.phpt
index a3490215afd..c1386693210 100644
--- a/ext/filter/tests/bug51368.phpt
+++ b/ext/filter/tests/bug51368.phpt
@@ -14,11 +14,11 @@
 try {
     filter_var('12345', FILTER_VALIDATE_FLOAT, $options);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 ?>
 --EXPECT--
 float(1000)
 float(1234.567)
-filter_var(): "thousand" option must not be empty
+ValueError: filter_var(): "thousand" option must not be empty
diff --git a/ext/filter/tests/throw-on-failure/filter_input_array_failure.phpt b/ext/filter/tests/throw-on-failure/filter_input_array_failure.phpt
index 868829dbbac..db857f0fef0 100644
--- a/ext/filter/tests/throw-on-failure/filter_input_array_failure.phpt
+++ b/ext/filter/tests/throw-on-failure/filter_input_array_failure.phpt
@@ -11,14 +11,14 @@
 try {
 	filter_input_array(INPUT_GET, ['a' => ['flags' => FILTER_REQUIRE_ARRAY | FILTER_THROW_ON_FAILURE]]);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nvalidation fails (filter value)\n";
 try {
 	filter_input_array(INPUT_GET, ['a' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_THROW_ON_FAILURE]]);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
diff --git a/ext/filter/tests/throw-on-failure/filter_input_failure.phpt b/ext/filter/tests/throw-on-failure/filter_input_failure.phpt
index 8ec2d572e7f..7130a777960 100644
--- a/ext/filter/tests/throw-on-failure/filter_input_failure.phpt
+++ b/ext/filter/tests/throw-on-failure/filter_input_failure.phpt
@@ -11,21 +11,21 @@
 try {
 	filter_input(INPUT_GET, 'b', FILTER_DEFAULT, FILTER_THROW_ON_FAILURE);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nvalidation fails (array type check)\n";
 try {
 	filter_input(INPUT_GET, 'a', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY | FILTER_THROW_ON_FAILURE);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nvalidation fails (filter value)\n";
 try {
 	filter_input(INPUT_GET, 'a', FILTER_VALIDATE_EMAIL, FILTER_THROW_ON_FAILURE);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
diff --git a/ext/filter/tests/throw-on-failure/filter_var_array_failure.phpt b/ext/filter/tests/throw-on-failure/filter_var_array_failure.phpt
index f40dec1537d..36d1db4eaa1 100644
--- a/ext/filter/tests/throw-on-failure/filter_var_array_failure.phpt
+++ b/ext/filter/tests/throw-on-failure/filter_var_array_failure.phpt
@@ -9,21 +9,21 @@
 try {
 	filter_var_array(['a' => 'a'], ['a' => ['flags' => FILTER_REQUIRE_ARRAY | FILTER_THROW_ON_FAILURE]]);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nvalidation fails (object without __toString)\n";
 try {
 	filter_var_array(['a' => new stdClass()], ['a' => ['flags' => FILTER_THROW_ON_FAILURE]]);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nvalidation fails (filter value)\n";
 try {
 	filter_var_array(['a' => true], ['a' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_THROW_ON_FAILURE]]);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
diff --git a/ext/filter/tests/throw-on-failure/filter_var_failure.phpt b/ext/filter/tests/throw-on-failure/filter_var_failure.phpt
index fccc61da4d0..d7a53105200 100644
--- a/ext/filter/tests/throw-on-failure/filter_var_failure.phpt
+++ b/ext/filter/tests/throw-on-failure/filter_var_failure.phpt
@@ -9,21 +9,21 @@
 try {
 	filter_var('a', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY | FILTER_THROW_ON_FAILURE);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nvalidation fails (object without __toString)\n";
 try {
 	filter_var(new stdClass(), FILTER_VALIDATE_EMAIL, FILTER_THROW_ON_FAILURE);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nvalidation fails (filter value)\n";
 try {
 	filter_var('a', FILTER_VALIDATE_EMAIL, FILTER_THROW_ON_FAILURE);
 } catch (Filter\FilterFailedException $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
diff --git a/ext/filter/tests/throw-on-failure/throw-and-null-error.phpt b/ext/filter/tests/throw-on-failure/throw-and-null-error.phpt
index 48c37618ed9..3dff1a85f78 100644
--- a/ext/filter/tests/throw-on-failure/throw-and-null-error.phpt
+++ b/ext/filter/tests/throw-on-failure/throw-and-null-error.phpt
@@ -13,54 +13,54 @@
 try {
 	filter_input(INPUT_GET, 'b', FILTER_DEFAULT, $flags);
 } catch (ValueError $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
 	filter_input(INPUT_GET, 'b', FILTER_DEFAULT, ['flags' => $flags]);
 } catch (ValueError $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 echo "\nfilter_input(), with a missing value and a default\n";
 try {
 	filter_input(INPUT_GET, 'b', FILTER_DEFAULT, ['flags' => $flags, 'options' => ['default' => 'a']]);
 } catch (ValueError $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 echo "\nfilter_input(), with a present value\n";
 try {
 	filter_input(INPUT_GET, 'a', FILTER_DEFAULT, $flags);
 } catch (ValueError $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
 	filter_input(INPUT_GET, 'a', FILTER_DEFAULT, ['flags' => $flags]);
 } catch (ValueError $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 echo "\nfilter_var()\n";
 try {
 	filter_var(true, FILTER_DEFAULT, $flags);
 } catch (ValueError $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
 	filter_var(true, FILTER_DEFAULT, ['flags' => $flags]);
 } catch (ValueError $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nfilter_input_array()\n";
 try {
 	filter_input_array(INPUT_GET, ['a' => ['flags' => $flags]]);
 } catch (ValueError $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nfilter_var_array()\n";
 try {
 	filter_var_array(['a' => true], ['a' => ['flags' => $flags]]);
 } catch (ValueError $e) {
-	echo get_class($e) . ": " . $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
diff --git a/ext/ftp/tests/004.phpt b/ext/ftp/tests/004.phpt
index fde0b509039..131fe984a1d 100644
--- a/ext/ftp/tests/004.phpt
+++ b/ext/ftp/tests/004.phpt
@@ -11,7 +11,7 @@
 try {
     ftp_connect('127.0.0.1', 0, -3);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 $ftp = ftp_connect('127.0.0.1', $port);
@@ -23,7 +23,7 @@
 var_dump(ftp_quit($ftp));
 ?>
 --EXPECTF--
-ftp_connect(): Argument #3 ($timeout) must be greater than 0
+ValueError: ftp_connect(): Argument #3 ($timeout) must be greater than 0
 bool(true)

 Warning: ftp_login(): Not logged in. in %s on line %d
diff --git a/ext/ftp/tests/005.phpt b/ext/ftp/tests/005.phpt
index f08cadd2b42..632badc9c59 100644
--- a/ext/ftp/tests/005.phpt
+++ b/ext/ftp/tests/005.phpt
@@ -22,19 +22,19 @@
 try {
     ftp_fget($ftp, STDOUT, 'x', 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     ftp_fput($ftp, 'x', fopen(__FILE__, 'r'), 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     ftp_get($ftp, 'x', 'y', 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 var_dump(ftp_mdtm($ftp, 'x'));
@@ -44,13 +44,13 @@
 try {
     ftp_nb_fget($ftp, STDOUT, 'x', 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     ftp_nb_fput($ftp, 'x', fopen(__FILE__, 'r'), 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 var_dump(ftp_systype($ftp));
@@ -77,9 +77,9 @@

 Warning: ftp_exec(): Command not implemented (5). in %s005.php on line %d
 bool(false)
-ftp_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
-ftp_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
-ftp_get(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
+ValueError: ftp_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
+ValueError: ftp_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
+ValueError: ftp_get(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
 int(-1)

 Warning: ftp_mkdir(): Command not implemented (7). in %s005.php on line %d
@@ -87,8 +87,8 @@

 Warning: ftp_nb_continue(): No non-blocking transfer to continue in %s on line %d
 int(0)
-ftp_nb_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
-ftp_nb_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
+ValueError: ftp_nb_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
+ValueError: ftp_nb_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY

 Warning: ftp_systype(): Command not implemented (8). in %s005.php on line %d
 bool(false)
diff --git a/ext/ftp/tests/007.phpt b/ext/ftp/tests/007.phpt
index a23b5496be9..38eb20badd7 100644
--- a/ext/ftp/tests/007.phpt
+++ b/ext/ftp/tests/007.phpt
@@ -13,202 +13,202 @@
 try {
     var_dump(ftp_login($ftp, 'user', 'pass'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_pwd($ftp));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_cdup($ftp));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_chdir($ftp, '~'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_exec($ftp, 'x'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_raw($ftp, 'x'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_mkdir($ftp, '/'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_rmdir($ftp, '/'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_chmod($ftp, 7777, '/'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_alloc($ftp, 7777));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_nlist($ftp, '/'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_rawlist($ftp, '~'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_mlsd($ftp, '~'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_systype($ftp));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_fget($ftp, $ftp, 'remote', 7777));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_pasv($ftp, false));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_get($ftp, 'local', 'remote', 7777));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_nb_continue($ftp));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_fput($ftp, 'remote', $ftp, 9999));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_put($ftp, 'remote', 'local', 9999));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_append($ftp, 'remote', 'local', 9999));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_size($ftp, '~'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_mdtm($ftp, '~'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_rename($ftp, 'old', 'new'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_delete($ftp, 'gone'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_site($ftp, 'localhost'));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_close($ftp));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_set_option($ftp, 1, 2));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(ftp_get_option($ftp, 1));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 fclose($ftp);
 ?>
 --EXPECT--
-ftp_login(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_pwd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_cdup(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_chdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_exec(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_raw(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_mkdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_rmdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_chmod(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_alloc(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_rawlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_mlsd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_systype(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_nb_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_pasv(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_nb_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_nb_continue(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_nb_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_append(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_nb_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_size(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_mdtm(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_rename(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_delete(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_site(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_close(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_set_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
-ftp_get_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_login(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_pwd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_cdup(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_chdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_exec(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_raw(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_mkdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_rmdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_chmod(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_alloc(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_rawlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_mlsd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_systype(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_nb_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_pasv(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_nb_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_nb_continue(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_nb_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_append(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_nb_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_size(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_mdtm(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_rename(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_delete(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_site(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_close(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_set_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
+TypeError: ftp_get_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given
diff --git a/ext/ftp/tests/dead-resource.phpt b/ext/ftp/tests/dead-resource.phpt
index 75cf3c4a55f..90e59d19641 100644
--- a/ext/ftp/tests/dead-resource.phpt
+++ b/ext/ftp/tests/dead-resource.phpt
@@ -16,10 +16,10 @@
     var_dump(ftp_login($ftp, 'user', 'pass'));
     echo "Login did not throw\n";
 } catch (ValueError $ex) {
-    echo "Exception: ", $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
 bool(true)
 bool(true)
-Exception: FTP\Connection is already closed
+ValueError: FTP\Connection is already closed
diff --git a/ext/ftp/tests/ftp_close_during_transfer.phpt b/ext/ftp/tests/ftp_close_during_transfer.phpt
index 72e41060392..201a6f17268 100644
--- a/ext/ftp/tests/ftp_close_during_transfer.phpt
+++ b/ext/ftp/tests/ftp_close_during_transfer.phpt
@@ -32,7 +32,7 @@ public function stream_eof() {
 try {
     @ftp_get($ftp, 'reentrant://sink', 'a story.txt', FTP_BINARY);
 } catch (\Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ftp_close($ftp);
@@ -40,5 +40,5 @@ public function stream_eof() {
 ?>
 --EXPECT--
 bool(true)
-Cannot close FTP\Connection while a transfer is in progress
+Error: Cannot close FTP\Connection while a transfer is in progress
 closed
diff --git a/ext/ftp/tests/ftp_constructor.phpt b/ext/ftp/tests/ftp_constructor.phpt
index 6fae7f9d3fa..70ac410ffe6 100644
--- a/ext/ftp/tests/ftp_constructor.phpt
+++ b/ext/ftp/tests/ftp_constructor.phpt
@@ -9,8 +9,8 @@
 try {
     new FTP\Connection();
 } catch (Error $ex) {
-    echo "Exception: ", $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Exception: Cannot directly construct FTP\Connection, use ftp_connect() or ftp_ssl_connect() instead
+Error: Cannot directly construct FTP\Connection, use ftp_connect() or ftp_ssl_connect() instead
diff --git a/ext/ftp/tests/ftp_get_option.phpt b/ext/ftp/tests/ftp_get_option.phpt
index 496fceadffe..56738f2c6c7 100644
--- a/ext/ftp/tests/ftp_get_option.phpt
+++ b/ext/ftp/tests/ftp_get_option.phpt
@@ -21,7 +21,7 @@
 try {
     ftp_get_option($ftp, FOO_BAR);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 ?>
@@ -29,4 +29,4 @@
 int(%d)
 bool(true)
 bool(true)
-ftp_get_option(): Argument #2 ($option) must be one of FTP_TIMEOUT_SEC, FTP_AUTOSEEK, or FTP_USEPASVADDRESS
+ValueError: ftp_get_option(): Argument #2 ($option) must be one of FTP_TIMEOUT_SEC, FTP_AUTOSEEK, or FTP_USEPASVADDRESS
diff --git a/ext/ftp/tests/ftp_nb_close_during_transfer.phpt b/ext/ftp/tests/ftp_nb_close_during_transfer.phpt
index 702648f6959..aacc4dfd77b 100644
--- a/ext/ftp/tests/ftp_nb_close_during_transfer.phpt
+++ b/ext/ftp/tests/ftp_nb_close_during_transfer.phpt
@@ -32,7 +32,7 @@ public function stream_eof() {
 try {
     @ftp_nb_get($ftp, 'reentrantnb://sink', 'a story.txt', FTP_BINARY);
 } catch (\Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ftp_close($ftp);
@@ -40,5 +40,5 @@ public function stream_eof() {
 ?>
 --EXPECT--
 bool(true)
-Cannot close FTP\Connection while a transfer is in progress
+Error: Cannot close FTP\Connection while a transfer is in progress
 closed
diff --git a/ext/ftp/tests/ftp_set_option_errors.phpt b/ext/ftp/tests/ftp_set_option_errors.phpt
index 35785e7f1eb..5b30dfdef2d 100644
--- a/ext/ftp/tests/ftp_set_option_errors.phpt
+++ b/ext/ftp/tests/ftp_set_option_errors.phpt
@@ -24,13 +24,13 @@
 foreach ($options as $option) try {
 	var_dump(ftp_set_option($ftp, $option['option'], $option['value']));
 } catch (\Throwable $ex) {
-	echo "Exception: ", $ex->getMessage(), "\n";
+	echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Exception: ftp_set_option(): Argument #3 ($value) must be greater than 0 for the FTP_TIMEOUT_SEC option
-Exception: ftp_set_option(): Argument #3 ($value) must be of type int for the FTP_TIMEOUT_SEC option, string given
-Exception: ftp_set_option(): Argument #3 ($value) must be of type bool for the FTP_USEPASVADDRESS option, array given
-Exception: ftp_set_option(): Argument #3 ($value) must be of type bool for the FTP_AUTOSEEK option, string given
-Exception: ftp_set_option(): Argument #2 ($option) must be one of FTP_TIMEOUT_SEC, FTP_AUTOSEEK, or FTP_USEPASVADDRESS
+ValueError: ftp_set_option(): Argument #3 ($value) must be greater than 0 for the FTP_TIMEOUT_SEC option
+TypeError: ftp_set_option(): Argument #3 ($value) must be of type int for the FTP_TIMEOUT_SEC option, string given
+TypeError: ftp_set_option(): Argument #3 ($value) must be of type bool for the FTP_USEPASVADDRESS option, array given
+TypeError: ftp_set_option(): Argument #3 ($value) must be of type bool for the FTP_AUTOSEEK option, string given
+ValueError: ftp_set_option(): Argument #2 ($option) must be one of FTP_TIMEOUT_SEC, FTP_AUTOSEEK, or FTP_USEPASVADDRESS
diff --git a/ext/ftp/tests/ftp_ssl_connect_error.phpt b/ext/ftp/tests/ftp_ssl_connect_error.phpt
index 65c7efbb23c..a12a3d4add9 100644
--- a/ext/ftp/tests/ftp_ssl_connect_error.phpt
+++ b/ext/ftp/tests/ftp_ssl_connect_error.phpt
@@ -18,7 +18,7 @@
 try {
     ftp_ssl_connect('totes.invalid', 21, 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 echo "===DONE===\n";
@@ -32,5 +32,5 @@
 bool(false)

 -- Testing ftp_ssl_connect() function timeout exception for value 0 --
-ftp_ssl_connect(): Argument #3 ($timeout) must be greater than 0
+ValueError: ftp_ssl_connect(): Argument #3 ($timeout) must be greater than 0
 ===DONE===
diff --git a/ext/ftp/tests/gh20601.phpt b/ext/ftp/tests/gh20601.phpt
index 3ece7736c3a..f6013db497f 100644
--- a/ext/ftp/tests/gh20601.phpt
+++ b/ext/ftp/tests/gh20601.phpt
@@ -12,8 +12,8 @@
 try {
 	ftp_connect('127.0.0.1', 1024, PHP_INT_MAX);
 } catch (\ValueError $e) {
-	echo $e->getMessage();
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-ftp_connect(): Argument #3 ($timeout) must be less than %d
+ValueError: ftp_connect(): Argument #3 ($timeout) must be less than %d
diff --git a/ext/ftp/tests/gh20601_set_option.phpt b/ext/ftp/tests/gh20601_set_option.phpt
index 3317d4b5f2a..c722f4d1644 100644
--- a/ext/ftp/tests/gh20601_set_option.phpt
+++ b/ext/ftp/tests/gh20601_set_option.phpt
@@ -19,8 +19,8 @@
 try {
 	ftp_set_option($ftp, FTP_TIMEOUT_SEC, PHP_INT_MAX);
 } catch (\ValueError $e) {
-	echo $e->getMessage();
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-ftp_set_option(): Argument #3 ($value) must be less than %d for the FTP_TIMEOUT_SEC option
+ValueError: ftp_set_option(): Argument #3 ($value) must be less than %d for the FTP_TIMEOUT_SEC option
diff --git a/ext/ftp/tests/gh20601_ssl.phpt b/ext/ftp/tests/gh20601_ssl.phpt
index 005f866e18e..12c1c54ae59 100644
--- a/ext/ftp/tests/gh20601_ssl.phpt
+++ b/ext/ftp/tests/gh20601_ssl.phpt
@@ -14,8 +14,8 @@
 try {
 	ftp_ssl_connect('127.0.0.1', 1024, PHP_INT_MAX);
 } catch (\ValueError $e) {
-	echo $e->getMessage();
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-ftp_ssl_connect(): Argument #3 ($timeout) must be less than %d
+ValueError: ftp_ssl_connect(): Argument #3 ($timeout) must be less than %d
diff --git a/ext/hash/tests/bug81714.phpt b/ext/hash/tests/bug81714.phpt
index a151bda6884..1f8557021a2 100644
--- a/ext/hash/tests/bug81714.phpt
+++ b/ext/hash/tests/bug81714.phpt
@@ -7,8 +7,8 @@
 try {
     serialize($h);
 } catch (Exception $ex) {
-    var_dump($ex->getMessage());
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
-string(52) "HashContext for algorithm "md5" cannot be serialized"
+Exception: HashContext for algorithm "md5" cannot be serialized
diff --git a/ext/hash/tests/gh12186_1.phpt b/ext/hash/tests/gh12186_1.phpt
index 5e34b1dd78e..afdfe5f7dbf 100644
--- a/ext/hash/tests/gh12186_1.phpt
+++ b/ext/hash/tests/gh12186_1.phpt
@@ -9,9 +9,9 @@
 try {
     hash_copy($c);
 } catch (Throwable $ex) {
-    echo $ex->getMessage() . "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-hash_copy(): Argument #1 ($context) must be a valid, non-finalized HashContext
+TypeError: hash_copy(): Argument #1 ($context) must be a valid, non-finalized HashContext
diff --git a/ext/hash/tests/gh12186_2.phpt b/ext/hash/tests/gh12186_2.phpt
index 64a12b15c39..46dc1232642 100644
--- a/ext/hash/tests/gh12186_2.phpt
+++ b/ext/hash/tests/gh12186_2.phpt
@@ -9,9 +9,9 @@
 try {
     clone $c;
 } catch (Throwable $ex) {
-    echo $ex->getMessage() . "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-Cannot clone a finalized HashContext
+ValueError: Cannot clone a finalized HashContext
diff --git a/ext/hash/tests/hash_equals.phpt b/ext/hash/tests/hash_equals.phpt
index 69e23eea0fa..c01e7be8c85 100644
--- a/ext/hash/tests/hash_equals.phpt
+++ b/ext/hash/tests/hash_equals.phpt
@@ -9,7 +9,7 @@ function trycatch_dump(...$tests) {
             var_dump($test());
         }
         catch (\Error $e) {
-            echo '[' . get_class($e) . '] ' . $e->getMessage() . "\n";
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
 }
@@ -39,9 +39,9 @@ function trycatch_dump(...$tests) {
 bool(false)
 bool(false)
 bool(true)
-[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, int given
-[TypeError] hash_equals(): Argument #2 ($user_string) must be of type string, int given
-[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, int given
-[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, null given
-[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, null given
-[TypeError] hash_equals(): Argument #1 ($known_string) must be of type string, null given
+TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, int given
+TypeError: hash_equals(): Argument #2 ($user_string) must be of type string, int given
+TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, int given
+TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given
+TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given
+TypeError: hash_equals(): Argument #1 ($known_string) must be of type string, null given
diff --git a/ext/hash/tests/hash_error.phpt b/ext/hash/tests/hash_error.phpt
index b5c03880913..63e99de7293 100644
--- a/ext/hash/tests/hash_error.phpt
+++ b/ext/hash/tests/hash_error.phpt
@@ -9,7 +9,7 @@
 try {
     hash('foo', '');
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 ?>
@@ -17,4 +17,4 @@
 *** Testing hash() : error conditions ***

 -- Testing hash() function with invalid hash algorithm --
-hash(): Argument #1 ($algo) must be a valid hashing algorithm
+ValueError: hash(): Argument #1 ($algo) must be a valid hashing algorithm
diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt
index 68ba55f4a37..a381d3bdd63 100644
--- a/ext/hash/tests/hash_file_error.phpt
+++ b/ext/hash/tests/hash_file_error.phpt
@@ -16,7 +16,7 @@
 try {
     hash_file('foobar', $filename);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 echo "\n-- Testing hash_file() function with a non-existent file --\n";
@@ -34,7 +34,7 @@
 *** Testing hash_file() : error conditions ***

 -- Testing hash_file() function with an unknown algorithm --
-hash_file(): Argument #1 ($algo) must be a valid hashing algorithm
+ValueError: hash_file(): Argument #1 ($algo) must be a valid hashing algorithm

 -- Testing hash_file() function with a non-existent file --

diff --git a/ext/hash/tests/hash_hkdf_edges.phpt b/ext/hash/tests/hash_hkdf_edges.phpt
index 89b3d8af635..77481802470 100644
--- a/ext/hash/tests/hash_hkdf_edges.phpt
+++ b/ext/hash/tests/hash_hkdf_edges.phpt
@@ -16,7 +16,7 @@
     var_dump(hash_hkdf('jOaAt', $ikm));
 }
 catch (\Error $e) {
-    echo '[Error] ' . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -26,4 +26,4 @@
 Length % digestSize != 0: 98b16391063ecee006a3ca8ee5776b1e5f
 Algo name case-sensitivity: true
 Non-crypto algo name case-sensitivity:
-[Error] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
diff --git a/ext/hash/tests/hash_hkdf_error.phpt b/ext/hash/tests/hash_hkdf_error.phpt
index 86aa10a02f3..f68d7a62fca 100644
--- a/ext/hash/tests/hash_hkdf_error.phpt
+++ b/ext/hash/tests/hash_hkdf_error.phpt
@@ -11,7 +11,7 @@ function trycatch_dump(...$tests) {
             var_dump($test());
         }
         catch (\Error $e) {
-            echo '[' . get_class($e) . '] ' . $e->getMessage() . "\n";
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
 }
@@ -48,19 +48,19 @@ function trycatch_dump(...$tests) {
 *** Testing hash_hkdf(): error conditions ***

 -- Testing hash_hkdf() function with invalid hash algorithm --
-[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm

 -- Testing hash_hkdf() function with non-cryptographic hash algorithm --
-[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
-[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
-[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
-[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
-[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
-[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
-[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
-[ValueError] hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hkdf(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm

 -- Testing hash_hkdf() function with invalid parameters --
-[ValueError] hash_hkdf(): Argument #2 ($key) must not be empty
-[ValueError] hash_hkdf(): Argument #3 ($length) must be greater than or equal to 0
-[ValueError] hash_hkdf(): Argument #3 ($length) must be less than or equal to 5100
+ValueError: hash_hkdf(): Argument #2 ($key) must not be empty
+ValueError: hash_hkdf(): Argument #3 ($length) must be greater than or equal to 0
+ValueError: hash_hkdf(): Argument #3 ($length) must be less than or equal to 5100
diff --git a/ext/hash/tests/hash_hmac_error.phpt b/ext/hash/tests/hash_hmac_error.phpt
index 81c28ee46c0..ad92d4a26ce 100644
--- a/ext/hash/tests/hash_hmac_error.phpt
+++ b/ext/hash/tests/hash_hmac_error.phpt
@@ -16,7 +16,7 @@
     var_dump(hash_hmac('foo', $data, $key));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\n-- Testing hash_hmac() function with non-cryptographic hash algorithm --\n";
@@ -24,7 +24,7 @@
     var_dump(hash_hmac('crc32', $data, $key));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -32,7 +32,7 @@
 *** Testing hash_hmac() : error conditions ***

 -- Testing hash_hmac() function with invalid hash algorithm --
-hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm

 -- Testing hash_hmac() function with non-cryptographic hash algorithm --
-hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hmac(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt
index 3a4d85ee7e3..c882975fed2 100644
--- a/ext/hash/tests/hash_hmac_file_error.phpt
+++ b/ext/hash/tests/hash_hmac_file_error.phpt
@@ -13,7 +13,7 @@
     var_dump(hash_hmac_file('foo', $file, $key, TRUE));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\n-- Testing hash_hmac_file() function with non-cryptographic hash algorithm --\n";
@@ -21,7 +21,7 @@
     var_dump(hash_hmac_file('crc32', $file, $key, TRUE));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\n-- Testing hash_hmac_file() function with bad path --\n";
@@ -29,7 +29,7 @@
     var_dump(hash_hmac_file('md5', $file.chr(0).$file, $key, TRUE));
 }
 catch (ValueError $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -37,10 +37,10 @@
 *** Testing hash() : error conditions ***

 -- Testing hash_hmac_file() function with invalid hash algorithm --
-hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm

 -- Testing hash_hmac_file() function with non-cryptographic hash algorithm --
-hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm

 -- Testing hash_hmac_file() function with bad path --
-hash_hmac_file(): Argument #2 ($filename) must not contain any null bytes
+ValueError: hash_hmac_file(): Argument #2 ($filename) must not contain any null bytes
diff --git a/ext/hash/tests/hash_init_error.phpt b/ext/hash/tests/hash_init_error.phpt
index 560ad4f8e9a..76fa392f6b2 100644
--- a/ext/hash/tests/hash_init_error.phpt
+++ b/ext/hash/tests/hash_init_error.phpt
@@ -9,7 +9,7 @@
     var_dump(hash_init('dummy'));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\n-- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --\n";
@@ -17,7 +17,7 @@
     var_dump(hash_init('crc32', HASH_HMAC));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\n-- Testing hash_init() function with HASH_HMAC and no key --\n";
@@ -25,14 +25,14 @@
     var_dump(hash_init('md5', HASH_HMAC));
 }
 catch (\Error $e) {
-    echo  $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     var_dump(hash_init('md5', HASH_HMAC, null));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }


@@ -41,13 +41,13 @@
 *** Testing hash_init(): error conditions ***

 -- Testing hash_init() function with unknown algorithms --
-hash_init(): Argument #1 ($algo) must be a valid hashing algorithm
+ValueError: hash_init(): Argument #1 ($algo) must be a valid hashing algorithm

 -- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --
-hash_init(): Argument #1 ($algo) must be a cryptographic hashing algorithm if HMAC is requested
+ValueError: hash_init(): Argument #1 ($algo) must be a cryptographic hashing algorithm if HMAC is requested

 -- Testing hash_init() function with HASH_HMAC and no key --
-hash_init(): Argument #3 ($key) must not be empty when HMAC is requested
+ValueError: hash_init(): Argument #3 ($key) must not be empty when HMAC is requested

 Deprecated: hash_init(): Passing null to parameter #3 ($key) of type string is deprecated in %s on line %d
-hash_init(): Argument #3 ($key) must not be empty when HMAC is requested
+ValueError: hash_init(): Argument #3 ($key) must not be empty when HMAC is requested
diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt
index 35cda2b52fc..d07a8caa234 100644
--- a/ext/hash/tests/hash_pbkdf2_error.phpt
+++ b/ext/hash/tests/hash_pbkdf2_error.phpt
@@ -16,7 +16,7 @@
     var_dump(hash_pbkdf2('foo', $password, $salt, 1));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }


@@ -25,7 +25,7 @@
     var_dump(hash_pbkdf2('crc32', $password, $salt, 1));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\n-- Testing hash_pbkdf2() function with invalid iterations --\n";
@@ -33,14 +33,14 @@
     var_dump(hash_pbkdf2('md5', $password, $salt, 0));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     var_dump(hash_pbkdf2('md5', $password, $salt, -1));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\n-- Testing hash_pbkdf2() function with invalid length --\n";
@@ -48,7 +48,7 @@
     var_dump(hash_pbkdf2('md5', $password, $salt, 1, -1));
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -56,14 +56,14 @@
 *** Testing hash_pbkdf2() : error conditions ***

 -- Testing hash_pbkdf2() function with invalid hash algorithm --
-hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm

 -- Testing hash_pbkdf2() function with non-cryptographic hash algorithm --
-hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
+ValueError: hash_pbkdf2(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm

 -- Testing hash_pbkdf2() function with invalid iterations --
-hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0
-hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0
+ValueError: hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0
+ValueError: hash_pbkdf2(): Argument #4 ($iterations) must be greater than 0

 -- Testing hash_pbkdf2() function with invalid length --
-hash_pbkdf2(): Argument #5 ($length) must be greater than or equal to 0
+ValueError: hash_pbkdf2(): Argument #5 ($length) must be greater than or equal to 0
diff --git a/ext/hash/tests/hash_serialize_002.phpt b/ext/hash/tests/hash_serialize_002.phpt
index 15ecf94c1e5..40157bf3800 100644
--- a/ext/hash/tests/hash_serialize_002.phpt
+++ b/ext/hash/tests/hash_serialize_002.phpt
@@ -18,7 +18,7 @@
         $serial = serialize($ctx0);
         assert(is_string($serial));
     } catch (Throwable $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }

@@ -26,91 +26,91 @@
 ?>
 --EXPECT--
 string(3) "md2"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(3) "md4"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(3) "md5"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(4) "sha1"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(6) "sha224"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(6) "sha256"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(6) "sha384"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "sha512/224"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "sha512/256"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(6) "sha512"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(8) "sha3-224"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(8) "sha3-256"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(8) "sha3-384"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(8) "sha3-512"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(9) "ripemd128"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(9) "ripemd160"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(9) "ripemd256"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(9) "ripemd320"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(9) "whirlpool"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "tiger128,3"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "tiger160,3"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "tiger192,3"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "tiger128,4"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "tiger160,4"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "tiger192,4"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(6) "snefru"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(9) "snefru256"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(4) "gost"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(11) "gost-crypto"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval128,3"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval160,3"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval192,3"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval224,3"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval256,3"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval128,4"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval160,4"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval192,4"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval224,4"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval256,4"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval128,5"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval160,5"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval192,5"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval224,5"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 string(10) "haval256,5"
-HashContext with HASH_HMAC option cannot be serialized
+Exception: HashContext with HASH_HMAC option cannot be serialized
 Done
diff --git a/ext/hash/tests/hash_serialize_003.phpt b/ext/hash/tests/hash_serialize_003.phpt
index a687c2aeffb..541a3169e53 100644
--- a/ext/hash/tests/hash_serialize_003.phpt
+++ b/ext/hash/tests/hash_serialize_003.phpt
@@ -237,7 +237,7 @@ function test_serialization($serial, $hash, $algo) {
         }
     } catch (Throwable $e) {
         echo "$algo: problem with serialization {$serial}\n";
-        echo "  ", $e->getMessage(), "\n", $e->getTraceAsString();
+        echo '  ', $e::class . ': ' . $e->getMessage(), "\n", $e->getTraceAsString();
     }
 }

diff --git a/ext/hash/tests/hash_serialize_004.phpt b/ext/hash/tests/hash_serialize_004.phpt
index ee5c08f973e..6c6f9936575 100644
--- a/ext/hash/tests/hash_serialize_004.phpt
+++ b/ext/hash/tests/hash_serialize_004.phpt
@@ -8,7 +8,7 @@
 try {
     $ctx->__unserialize($ctx->__serialize());
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 // bad formats
@@ -26,20 +26,20 @@
         $ctx = unserialize(base64_decode($serial));
         echo "Unexpected success\n";
     } catch (Exception $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }

 echo "Done\n";
 ?>
 --EXPECT--
-HashContext::__unserialize called on initialized object
-Incomplete or ill-formed serialization data
-Incomplete or ill-formed serialization data
-Incomplete or ill-formed serialization data
-HashContext with HASH_HMAC option cannot be serialized
-Incomplete or ill-formed serialization data ("sha1" code -1)
-Incomplete or ill-formed serialization data ("sha1" code -1024)
-Incomplete or ill-formed serialization data ("sha1" code -1)
-Unknown hash algorithm
+Exception: HashContext::__unserialize called on initialized object
+Exception: Incomplete or ill-formed serialization data
+Exception: Incomplete or ill-formed serialization data
+Exception: Incomplete or ill-formed serialization data
+Exception: HashContext with HASH_HMAC option cannot be serialized
+Exception: Incomplete or ill-formed serialization data ("sha1" code -1)
+Exception: Incomplete or ill-formed serialization data ("sha1" code -1024)
+Exception: Incomplete or ill-formed serialization data ("sha1" code -1)
+Exception: Unknown hash algorithm
 Done
diff --git a/ext/hash/tests/new-context.phpt b/ext/hash/tests/new-context.phpt
index dd8e92e029b..345f53adfce 100644
--- a/ext/hash/tests/new-context.phpt
+++ b/ext/hash/tests/new-context.phpt
@@ -6,8 +6,8 @@
 try {
   new HashContext;
 } catch (Error $e) {
-  echo "Exception: {$e->getMessage()}\n";
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Exception: Call to private HashContext::__construct() from global scope
+Error: Call to private HashContext::__construct() from global scope
diff --git a/ext/hash/tests/reuse.phpt b/ext/hash/tests/reuse.phpt
index b5cfc79c162..9ca8f4ceda6 100644
--- a/ext/hash/tests/reuse.phpt
+++ b/ext/hash/tests/reuse.phpt
@@ -9,9 +9,9 @@
     hash_update($h, 'foo');
 }
 catch (\Error $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-hash_update(): Argument #1 ($context) must be a valid, non-finalized HashContext
+TypeError: hash_update(): Argument #1 ($context) must be a valid, non-finalized HashContext
diff --git a/ext/hash/tests/xxhash_secret.phpt b/ext/hash/tests/xxhash_secret.phpt
index 4cd6798ef76..768032169af 100644
--- a/ext/hash/tests/xxhash_secret.phpt
+++ b/ext/hash/tests/xxhash_secret.phpt
@@ -18,19 +18,19 @@ public function __toString(): string {
 	try {
 		$ctx = hash_init($a, options: ["seed" => 24, "secret" => $secret]);
 	} catch (Throwable $e) {
-		var_dump($e->getMessage());
+		echo $e::class, ': ', $e->getMessage(), "\n";
 	}

 	try {
 		$ctx = hash_init($a, options: ["secret" => new StringableThrowingClass()]);
 	} catch (Throwable $e) {
-		var_dump($e->getMessage());
+		echo $e::class, ': ', $e->getMessage(), "\n";
 	}

 	try {
 		$ctx = hash_init($a, options: ["secret" => str_repeat('a', 17)]);
 	} catch (Throwable $e) {
-		var_dump($e->getMessage());
+		echo $e::class, ': ', $e->getMessage(), "\n";
 	}

 	$ctx = hash_init($a, options: ["secret" => $secret]);
@@ -47,15 +47,15 @@ public function __toString(): string {

 ?>
 --EXPECTF--
-string(67) "xxh3: Only one of seed or secret is to be passed for initialization"
+Error: xxh3: Only one of seed or secret is to be passed for initialization

 Deprecated: hash_init(): Passing a secret of a type other than string is deprecated because it implicitly converts to a string, potentially hiding bugs in %s on line %d
-string(23) "exception in __toString"
-string(57) "xxh3: Secret length must be >= 136 bytes, 17 bytes passed"
+Exception: exception in __toString
+Error: xxh3: Secret length must be >= 136 bytes, 17 bytes passed
 8028aa834c03557a == 8028aa834c03557a == true
-string(69) "xxh128: Only one of seed or secret is to be passed for initialization"
+Error: xxh128: Only one of seed or secret is to be passed for initialization

 Deprecated: hash_init(): Passing a secret of a type other than string is deprecated because it implicitly converts to a string, potentially hiding bugs in %s on line %d
-string(23) "exception in __toString"
-string(59) "xxh128: Secret length must be >= 136 bytes, 17 bytes passed"
+Exception: exception in __toString
+Error: xxh128: Secret length must be >= 136 bytes, 17 bytes passed
 54279097795e7218093a05d4d781cbb9 == 54279097795e7218093a05d4d781cbb9 == true
diff --git a/ext/hash/tests/xxhash_unserialize_memsize.phpt b/ext/hash/tests/xxhash_unserialize_memsize.phpt
index 6de78ee0711..d287f0a368f 100644
--- a/ext/hash/tests/xxhash_unserialize_memsize.phpt
+++ b/ext/hash/tests/xxhash_unserialize_memsize.phpt
@@ -9,7 +9,7 @@
     $hash = unserialize($str);
     hash_update($hash, '');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
@@ -19,9 +19,9 @@
     $hash = unserialize($str);
     hash_update($hash, '');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Incomplete or ill-formed serialization data ("xxh32" code -2000)
-Incomplete or ill-formed serialization data ("xxh64" code -2000)
+Exception: Incomplete or ill-formed serialization data ("xxh32" code -2000)
+Exception: Incomplete or ill-formed serialization data ("xxh64" code -2000)
diff --git a/ext/iconv/tests/bug78069.phpt b/ext/iconv/tests/bug78069.phpt
index 88cf6e35f82..1c2fdd1a64c 100644
--- a/ext/iconv/tests/bug78069.phpt
+++ b/ext/iconv/tests/bug78069.phpt
@@ -10,4 +10,4 @@
 DONE
 --EXPECT--
 int(1)
-DONE
\ No newline at end of file
+DONE
diff --git a/ext/iconv/tests/iconv_strpos.phpt b/ext/iconv/tests/iconv_strpos.phpt
index c32fe921e62..e423c694b39 100644
--- a/ext/iconv/tests/iconv_strpos.phpt
+++ b/ext/iconv/tests/iconv_strpos.phpt
@@ -14,7 +14,7 @@ function foo($haystk, $needle, $offset, $to_charset = false, $from_charset = fal
     try {
         var_dump(strpos($haystk, $needle, $offset));
     } catch (ValueError $exception) {
-        echo $exception->getMessage() . "\n";
+        echo $exception::class, ': ', $exception->getMessage(), "\n";
     }
     try {
         if ($to_charset !== false) {
@@ -23,7 +23,7 @@ function foo($haystk, $needle, $offset, $to_charset = false, $from_charset = fal
             var_dump(iconv_strpos($haystk, $needle, $offset));
         }
     } catch (ValueError $exception) {
-        echo $exception->getMessage() . "\n";
+        echo $exception::class, ': ', $exception->getMessage(), "\n";
     }
 }
 foo("abecdbcdabef", "bcd", -1);
@@ -48,8 +48,8 @@ function foo($haystk, $needle, $offset, $to_charset = false, $from_charset = fal
 int(5)
 bool(false)
 bool(false)
-strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
 int(7)
 int(7)
 int(16)
diff --git a/ext/iconv/tests/iconv_strpos_variation5.phpt b/ext/iconv/tests/iconv_strpos_variation5.phpt
index 2cf4b947616..ae7487a19e9 100644
--- a/ext/iconv/tests/iconv_strpos_variation5.phpt
+++ b/ext/iconv/tests/iconv_strpos_variation5.phpt
@@ -32,13 +32,13 @@
     try {
         var_dump(iconv_strpos($string_ascii, $needle_ascii, $i));
     } catch (ValueError $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     echo "--Multibyte String --\n";
     try {
         var_dump(iconv_strpos($string_mb, $needle_mb, $i, 'UTF-8'));
     } catch (ValueError $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }

@@ -49,9 +49,9 @@

 **-- Offset is: -30 --**
 -- ASCII String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
 --Multibyte String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)

 **-- Offset is: -20 --**
 -- ASCII String --
@@ -85,25 +85,25 @@

 **-- Offset is: 30 --**
 -- ASCII String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
 --Multibyte String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)

 **-- Offset is: 40 --**
 -- ASCII String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
 --Multibyte String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)

 **-- Offset is: 50 --**
 -- ASCII String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
 --Multibyte String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)

 **-- Offset is: 60 --**
 -- ASCII String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
 --Multibyte String --
-iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
+ValueError: iconv_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
 Done
diff --git a/ext/ldap/tests/gh18902.phpt b/ext/ldap/tests/gh18902.phpt
index 329cbb59c1b..0df0543a8f7 100644
--- a/ext/ldap/tests/gh18902.phpt
+++ b/ext/ldap/tests/gh18902.phpt
@@ -9,22 +9,22 @@
 try {
 	ldap_exop($conn,"\0");
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	ldap_exop_sync($conn,"");
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	ldap_exop_sync($conn,"test\0");
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-ldap_exop(): Argument #2 ($request_oid) must not contain any null bytes
-ldap_exop_sync(): Argument #2 ($request_oid) must not be empty
-ldap_exop_sync(): Argument #2 ($request_oid) must not contain any null bytes
+ValueError: ldap_exop(): Argument #2 ($request_oid) must not contain any null bytes
+ValueError: ldap_exop_sync(): Argument #2 ($request_oid) must not be empty
+ValueError: ldap_exop_sync(): Argument #2 ($request_oid) must not contain any null bytes
diff --git a/ext/ldap/tests/gh21262.phpt b/ext/ldap/tests/gh21262.phpt
index 3e414a9cbb1..52336ee070d 100644
--- a/ext/ldap/tests/gh21262.phpt
+++ b/ext/ldap/tests/gh21262.phpt
@@ -17,14 +17,14 @@
 try {
 	ldap_add($ldap, $valid_dn, $entry_with_empty_array);
 } catch (ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 // ldap_mod_add() should still reject empty arrays
 try {
 	ldap_mod_add($ldap, $valid_dn, $entry_with_empty_array);
 } catch (ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 // ldap_modify() should accept empty arrays (delete attribute)
@@ -32,7 +32,7 @@
 	@ldap_modify($ldap, $valid_dn, $entry_with_empty_array);
 	echo "ldap_modify: no ValueError thrown", PHP_EOL;
 } catch (ValueError $e) {
-	echo "ldap_modify: UNEXPECTED ValueError: ", $e->getMessage(), PHP_EOL;
+	echo 'ldap_modify: UNEXPECTED: ', $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 // ldap_mod_del() should accept empty arrays (delete attribute)
@@ -40,11 +40,11 @@
 	@ldap_mod_del($ldap, $valid_dn, $entry_with_empty_array);
 	echo "ldap_mod_del: no ValueError thrown", PHP_EOL;
 } catch (ValueError $e) {
-	echo "ldap_mod_del: UNEXPECTED ValueError: ", $e->getMessage(), PHP_EOL;
+	echo 'ldap_mod_del: UNEXPECTED: ', $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-ldap_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values
-ldap_mod_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values
+ValueError: ldap_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values
+ValueError: ldap_mod_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values
 ldap_modify: no ValueError thrown
 ldap_mod_del: no ValueError thrown
diff --git a/ext/ldap/tests/ldap_connect_port_error.phpt b/ext/ldap/tests/ldap_connect_port_error.phpt
index 55d41d395b1..8809b84d8a0 100644
--- a/ext/ldap/tests/ldap_connect_port_error.phpt
+++ b/ext/ldap/tests/ldap_connect_port_error.phpt
@@ -10,15 +10,15 @@
 try {
 	ldap_connect("nope://$host", 65536);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	ldap_connect("nope://$host", 0);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-ldap_connect(): Argument #2 ($port) must be between 1 and 65535
-ldap_connect(): Argument #2 ($port) must be between 1 and 65535
+ValueError: ldap_connect(): Argument #2 ($port) must be between 1 and 65535
+ValueError: ldap_connect(): Argument #2 ($port) must be between 1 and 65535
diff --git a/ext/ldap/tests/ldap_constructor.phpt b/ext/ldap/tests/ldap_constructor.phpt
index d405bd33d90..f48d14dfa98 100644
--- a/ext/ldap/tests/ldap_constructor.phpt
+++ b/ext/ldap/tests/ldap_constructor.phpt
@@ -8,8 +8,8 @@
 try {
     new LDAP\Connection();
 } catch (Error $ex) {
-    echo "Exception: ", $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Exception: Cannot directly construct LDAP\Connection, use ldap_connect() instead
+Error: Cannot directly construct LDAP\Connection, use ldap_connect() instead
diff --git a/ext/ldap/tests/ldap_first_attribute_error.phpt b/ext/ldap/tests/ldap_first_attribute_error.phpt
index 2776838501d..c84ca8607b7 100644
--- a/ext/ldap/tests/ldap_first_attribute_error.phpt
+++ b/ext/ldap/tests/ldap_first_attribute_error.phpt
@@ -13,8 +13,8 @@
 try {
     var_dump(ldap_first_attribute($link, $link));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-ldap_first_attribute(): Argument #2 ($entry) must be of type LDAP\ResultEntry, LDAP\Connection given
+TypeError: ldap_first_attribute(): Argument #2 ($entry) must be of type LDAP\ResultEntry, LDAP\Connection given
diff --git a/ext/ldap/tests/ldap_get_set_invalid_option_error.phpt b/ext/ldap/tests/ldap_get_set_invalid_option_error.phpt
index 2079353e48c..dacaa9c9836 100644
--- a/ext/ldap/tests/ldap_get_set_invalid_option_error.phpt
+++ b/ext/ldap/tests/ldap_get_set_invalid_option_error.phpt
@@ -9,12 +9,12 @@
 try {
     var_dump(ldap_set_option($ldap, 999999, "bogus"));
 } catch (Throwable $e) {
-    echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     var_dump(ldap_get_option($ldap, 999999, $value));
 } catch (Throwable $e) {
-    echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
diff --git a/ext/ldap/tests/ldap_list_read_search_parallel_programming_errors.phpt b/ext/ldap/tests/ldap_list_read_search_parallel_programming_errors.phpt
index 4f3567d9e00..286b44706aa 100644
--- a/ext/ldap/tests/ldap_list_read_search_parallel_programming_errors.phpt
+++ b/ext/ldap/tests/ldap_list_read_search_parallel_programming_errors.phpt
@@ -110,4 +110,4 @@
 TypeError: ldap_list(): Argument #2 ($base) must be a list of strings, int given
 TypeError: ldap_list(): Argument #3 ($filter) must be a list of strings, int given
 ValueError: ldap_list(): Argument #2 ($base) must not contain null bytes
-ValueError: ldap_list(): Argument #3 ($filter) must not contain null bytes
\ No newline at end of file
+ValueError: ldap_list(): Argument #3 ($filter) must not contain null bytes
diff --git a/ext/ldap/tests/ldap_set_option_error.phpt b/ext/ldap/tests/ldap_set_option_error.phpt
index eda3dc51217..92b84a2e917 100644
--- a/ext/ldap/tests/ldap_set_option_error.phpt
+++ b/ext/ldap/tests/ldap_set_option_error.phpt
@@ -29,7 +29,7 @@
     try {
         var_dump(ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $control));
     } catch (Error $exception) {
-        echo get_class($exception) . ": " . $exception->getMessage() . "\n";
+        echo $exception::class, ': ', $exception->getMessage(), "\n";
     }
 }

diff --git a/ext/ldap/tests/ldap_sort_control_missing_attr.phpt b/ext/ldap/tests/ldap_sort_control_missing_attr.phpt
index 0d6c3921f00..606894b7f37 100644
--- a/ext/ldap/tests/ldap_sort_control_missing_attr.phpt
+++ b/ext/ldap/tests/ldap_sort_control_missing_attr.phpt
@@ -20,11 +20,11 @@
         ],
     ]);
 } catch (\ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "ok\n";
 ?>
 --EXPECT--
-ldap_search(): Sort key list must have an "attr" key
+ValueError: ldap_search(): Sort key list must have an "attr" key
 ok
diff --git a/ext/pcre/tests/002.phpt b/ext/pcre/tests/002.phpt
index 14d19640206..ac3e54db459 100644
--- a/ext/pcre/tests/002.phpt
+++ b/ext/pcre/tests/002.phpt
@@ -6,7 +6,7 @@
 try {
     preg_match_all('//', '', $dummy, 0xdead);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 var_dump(preg_quote(''));
@@ -17,7 +17,7 @@

 ?>
 --EXPECTF--
-preg_match_all(): Argument #4 ($flags) must be a PREG_* constant
+ValueError: preg_match_all(): Argument #4 ($flags) must be a PREG_* constant
 string(0) ""
 string(12) "a${1b${1c${1"

diff --git a/ext/pcre/tests/bug21732.phpt b/ext/pcre/tests/bug21732.phpt
index 02a13713e2e..6fcbf47e305 100644
--- a/ext/pcre/tests/bug21732.phpt
+++ b/ext/pcre/tests/bug21732.phpt
@@ -12,12 +12,12 @@ function cb($param) {
 try {
     var_dump(preg_replace('', array(), ''));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde'));
 ?>
 --EXPECT--
-preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given
+TypeError: preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given
 array(4) {
   [0]=>
   string(5) "abcde"
diff --git a/ext/pcre/tests/gh16189.phpt b/ext/pcre/tests/gh16189.phpt
index c77ab7699ee..6e7dbaaf394 100644
--- a/ext/pcre/tests/gh16189.phpt
+++ b/ext/pcre/tests/gh16189.phpt
@@ -6,14 +6,14 @@
 try {
 	preg_match( '/<(\w+)[\s\w\-]+ id="S44_i89ew">/', '<br><div id="S44_i89ew">', $matches, 0, PHP_INT_MIN);
 } catch (\ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
 	preg_match_all( '/<(\w+)[\s\w\-]+ id="S44_i89ew">/', '<br><div id="S44_i89ew">', $matches, 0, PHP_INT_MIN);
 } catch (\ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-preg_match(): Argument #5 ($offset) must be greater than %s
-preg_match_all(): Argument #5 ($offset) must be greater than %s
+ValueError: preg_match(): Argument #5 ($offset) must be greater than %s
+ValueError: preg_match_all(): Argument #5 ($offset) must be greater than %s
diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt
index ae80ecc3506..0c1a4733ca9 100644
--- a/ext/pcre/tests/preg_grep_error1.phpt
+++ b/ext/pcre/tests/preg_grep_error1.phpt
@@ -25,18 +25,17 @@
     try {
         var_dump(preg_grep($value, $array));
     } catch (TypeError $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }
 $value = new stdclass(); //Object
 try {
     var_dump(preg_grep($value, $array));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
-
 Warning: preg_grep(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_grep_error1.php on line %d
 bool(false)

@@ -48,11 +47,11 @@

 Warning: preg_grep(): Unknown modifier 'F' in %spreg_grep_error1.php on line %d
 bool(false)
-preg_grep(): Argument #1 ($pattern) must be of type string, array given
+TypeError: preg_grep(): Argument #1 ($pattern) must be of type string, array given
 array(2) {
   [1]=>
   string(3) "abc"
   [2]=>
   string(4) "test"
 }
-preg_grep(): Argument #1 ($pattern) must be of type string, stdClass given
+TypeError: preg_grep(): Argument #1 ($pattern) must be of type string, stdClass given
diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt
index 92d1a6aff66..4965cc1913b 100644
--- a/ext/pcre/tests/preg_match_all_error1.phpt
+++ b/ext/pcre/tests/preg_match_all_error1.phpt
@@ -25,7 +25,7 @@
     try {
         var_dump(preg_match_all($regex_value, $subject, $matches1));
     } catch (TypeError $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     var_dump($matches1);
 }
@@ -33,12 +33,11 @@
 try {
     var_dump(preg_match_all($regex_value, $subject, $matches));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump($matches);
 ?>
 --EXPECTF--
-
 Warning: preg_match_all(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_match_all_error1.php on line %d
 bool(false)
 NULL
@@ -54,7 +53,7 @@
 Warning: preg_match_all(): Unknown modifier 'F' in %spreg_match_all_error1.php on line %d
 bool(false)
 NULL
-preg_match_all(): Argument #1 ($pattern) must be of type string, array given
+TypeError: preg_match_all(): Argument #1 ($pattern) must be of type string, array given
 NULL
 int(4)
 array(1) {
@@ -70,5 +69,5 @@
     string(1) "t"
   }
 }
-preg_match_all(): Argument #1 ($pattern) must be of type string, stdClass given
+TypeError: preg_match_all(): Argument #1 ($pattern) must be of type string, stdClass given
 NULL
diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt
index 870cc498792..6507f9e47dd 100644
--- a/ext/pcre/tests/preg_match_error1.phpt
+++ b/ext/pcre/tests/preg_match_error1.phpt
@@ -23,19 +23,18 @@
     try {
         var_dump(preg_match($regex_value, $subject));
     } catch (TypeError $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }
 $regex_value = new stdclass(); //Object
 try {
     var_dump(preg_match($regex_value, $subject));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-
 Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_match_error1.php on line %d
 bool(false)

@@ -47,6 +46,6 @@

 Warning: preg_match(): Unknown modifier 'F' in %spreg_match_error1.php on line %d
 bool(false)
-preg_match(): Argument #1 ($pattern) must be of type string, array given
+TypeError: preg_match(): Argument #1 ($pattern) must be of type string, array given
 int(1)
-preg_match(): Argument #1 ($pattern) must be of type string, stdClass given
+TypeError: preg_match(): Argument #1 ($pattern) must be of type string, stdClass given
diff --git a/ext/pcre/tests/preg_replace_callback_array2.phpt b/ext/pcre/tests/preg_replace_callback_array2.phpt
index aca11dc19c6..ffdcdea71db 100644
--- a/ext/pcre/tests/preg_replace_callback_array2.phpt
+++ b/ext/pcre/tests/preg_replace_callback_array2.phpt
@@ -9,7 +9,7 @@
 try {
     var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b));
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }


@@ -24,16 +24,16 @@ function f() {
 try {
     var_dump(preg_replace_callback_array(array('/\w/' => 'f', '/.*/' => 'f'), 'z'));
 } catch (Exception $e) {
-    var_dump($e->getMessage());
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Done\n";
 ?>
 --EXPECTF--
-preg_replace_callback_array(): Argument #1 ($pattern) must contain only valid callbacks
+TypeError: preg_replace_callback_array(): Argument #1 ($pattern) must contain only valid callbacks
 string(0) ""

 Warning: preg_replace_callback_array(): No ending delimiter '/' found in %spreg_replace_callback_array2.php on line %d
 NULL
-string(1) "1"
+Exception: 1
 Done
diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt
index 0a8a79751a9..5219496a553 100644
--- a/ext/pcre/tests/preg_replace_error1.phpt
+++ b/ext/pcre/tests/preg_replace_error1.phpt
@@ -29,11 +29,10 @@
 try {
     var_dump(preg_replace($regex_value, $replace, $subject));
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
-
 Warning: preg_replace(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_replace_error1.php on line %d
 NULL

@@ -47,4 +46,4 @@
 NULL
 string(1) "a"
 string(1) "1"
-preg_replace(): Argument #1 ($pattern) must be of type array|string, stdClass given
+TypeError: preg_replace(): Argument #1 ($pattern) must be of type array|string, stdClass given
diff --git a/ext/pcre/tests/preg_replace_error2.phpt b/ext/pcre/tests/preg_replace_error2.phpt
index 9bc36f655f4..6b4a1bfae93 100644
--- a/ext/pcre/tests/preg_replace_error2.phpt
+++ b/ext/pcre/tests/preg_replace_error2.phpt
@@ -15,17 +15,17 @@
     try {
         var_dump(preg_replace($regex, $value, $subject));
     } catch (TypeError $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }
 $value = new stdclass(); //Object
 try {
     var_dump(preg_replace($regex, $value, $subject));
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
 string(64) "this is a stringthis is a stringthis is a stringthis is a string"
-preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given
-preg_replace(): Argument #2 ($replacement) must be of type array|string, stdClass given
+TypeError: preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given
+TypeError: preg_replace(): Argument #2 ($replacement) must be of type array|string, stdClass given
diff --git a/ext/pcre/tests/preg_split_error1.phpt b/ext/pcre/tests/preg_split_error1.phpt
index 6555f21366a..9e9fd8c7133 100644
--- a/ext/pcre/tests/preg_split_error1.phpt
+++ b/ext/pcre/tests/preg_split_error1.phpt
@@ -25,18 +25,17 @@
     try {
         var_dump(preg_split($regex_value, $subject));
     } catch (TypeError $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }
 $regex_value = new stdclass(); //Object
 try {
     var_dump(preg_split($regex_value, $subject));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
-
 Warning: preg_split(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_split_error1.php on line %d
 bool(false)

@@ -48,7 +47,7 @@

 Warning: preg_split(): Unknown modifier 'F' in %spreg_split_error1.php on line %d
 bool(false)
-preg_split(): Argument #1 ($pattern) must be of type string, array given
+TypeError: preg_split(): Argument #1 ($pattern) must be of type string, array given
 array(3) {
   [0]=>
   string(4) "1 2 "
@@ -57,4 +56,4 @@
   [2]=>
   string(4) " 5 6"
 }
-preg_split(): Argument #1 ($pattern) must be of type string, stdClass given
+TypeError: preg_split(): Argument #1 ($pattern) must be of type string, stdClass given
diff --git a/ext/posix/tests/posix_access_flags.phpt b/ext/posix/tests/posix_access_flags.phpt
index 0989e2a2bc6..ba2104e6dc1 100644
--- a/ext/posix/tests/posix_access_flags.phpt
+++ b/ext/posix/tests/posix_access_flags.phpt
@@ -18,19 +18,19 @@
 try {
     posix_access($testfile, -1);
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     posix_access($testfile, 01000); // S_ISVTX bit (sticky)
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     posix_access($testfile, 02000); // S_ISGID bit
 } catch (ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 if (posix_access($testfile, POSIX_R_OK | POSIX_W_OK)) {
@@ -47,8 +47,8 @@
 @unlink(__DIR__ . '/testfile.txt');
 ?>
 --EXPECTF--
-posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK
-posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK
-posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK
+ValueError: posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK
+ValueError: posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK
+ValueError: posix_access(): Argument #2 ($flags) must be a bitmask of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK, and POSIX_X_OK
 Read/write access OK
 File exists OK
diff --git a/ext/posix/tests/posix_eaccess.phpt b/ext/posix/tests/posix_eaccess.phpt
index 4211e6ef13e..22c1577e493 100644
--- a/ext/posix/tests/posix_eaccess.phpt
+++ b/ext/posix/tests/posix_eaccess.phpt
@@ -12,9 +12,9 @@
 try {
     posix_eaccess(str_repeat('bogus path', 1042));
 } catch (ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-posix_eaccess(): Argument #1 ($filename) must not be empty
+ValueError: posix_eaccess(): Argument #1 ($filename) must not be empty
diff --git a/ext/posix/tests/posix_fpathconf.phpt b/ext/posix/tests/posix_fpathconf.phpt
index 91918d5901b..f0cb749228a 100644
--- a/ext/posix/tests/posix_fpathconf.phpt
+++ b/ext/posix/tests/posix_fpathconf.phpt
@@ -14,17 +14,16 @@
 try {
 	posix_fpathconf("string arg", POSIX_PC_PATH_MAX);
 } catch (\TypeError $e) {
-	echo $e->getMessage() . "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 $fd = fopen(__DIR__, "r");
 var_dump(posix_fpathconf($fd, POSIX_PC_PATH_MAX));
 fclose($fd);
 ?>
 --EXPECTF--
-
 Warning: posix_fpathconf(): Argument #1 ($file_descriptor) must be between 0 and %d in %s on line %d
 bool(false)
 bool(true)
 string(%d) "Bad file %r(descriptor|number)%r"
-posix_fpathconf(): Argument #1 ($file_descriptor) must be of type int|resource, string given
+TypeError: posix_fpathconf(): Argument #1 ($file_descriptor) must be of type int|resource, string given
 int(%d)
diff --git a/ext/posix/tests/posix_getsid_error.phpt b/ext/posix/tests/posix_getsid_error.phpt
index 68f16855499..39a1d146e48 100644
--- a/ext/posix/tests/posix_getsid_error.phpt
+++ b/ext/posix/tests/posix_getsid_error.phpt
@@ -12,8 +12,8 @@
 try {
 	posix_getsid(-1);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-posix_getsid(): Argument #1 ($process_id) must be between 0 and %d
+ValueError: posix_getsid(): Argument #1 ($process_id) must be between 0 and %d
diff --git a/ext/posix/tests/posix_kill_pidoverflow.phpt b/ext/posix/tests/posix_kill_pidoverflow.phpt
index 0e8b8c7b7df..9d70ef413d9 100644
--- a/ext/posix/tests/posix_kill_pidoverflow.phpt
+++ b/ext/posix/tests/posix_kill_pidoverflow.phpt
@@ -11,15 +11,15 @@
 try {
 	posix_kill(PHP_INT_MAX, SIGTERM);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
 	posix_kill(PHP_INT_MIN, SIGTERM);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-posix_kill(): Argument #1 ($process_id) must be between %i and %d
-posix_kill(): Argument #1 ($process_id) must be between %i and %d
+ValueError: posix_kill(): Argument #1 ($process_id) must be between %i and %d
+ValueError: posix_kill(): Argument #1 ($process_id) must be between %i and %d
diff --git a/ext/posix/tests/posix_pathconf.phpt b/ext/posix/tests/posix_pathconf.phpt
index ba451c62df9..2cb92894bdc 100644
--- a/ext/posix/tests/posix_pathconf.phpt
+++ b/ext/posix/tests/posix_pathconf.phpt
@@ -11,14 +11,14 @@
 try {
 	posix_pathconf('', POSIX_PC_PATH_MAX);
 } catch (\ValueError $e) {
-	echo $e->getMessage(). "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 var_dump(posix_pathconf(str_repeat('non_existent', 4096), POSIX_PC_NAME_MAX));
 var_dump(posix_errno() != 0);
 var_dump(posix_pathconf(sys_get_temp_dir(), POSIX_PC_PATH_MAX));
 ?>
 --EXPECTF--
-posix_pathconf(): Argument #1 ($path) must not be empty
+ValueError: posix_pathconf(): Argument #1 ($path) must not be empty
 bool(false)
 bool(true)
 int(%d)
diff --git a/ext/posix/tests/posix_setpgid_error.phpt b/ext/posix/tests/posix_setpgid_error.phpt
index 0d00dd87c60..f1d2dc334c5 100644
--- a/ext/posix/tests/posix_setpgid_error.phpt
+++ b/ext/posix/tests/posix_setpgid_error.phpt
@@ -9,26 +9,26 @@
 try {
 	posix_setpgid(PHP_INT_MAX, 1);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
 	posix_setpgid(-2, 1);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
 	posix_setpgid(1, PHP_INT_MAX);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
 	posix_setpgid(1, -2);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-posix_setpgid(): Argument #1 ($process_id) must be between 0 and %d
-posix_setpgid(): Argument #1 ($process_id) must be between 0 and %d
-posix_setpgid(): Argument #2 ($process_group_id) must be between 0 and %d
-posix_setpgid(): Argument #2 ($process_group_id) must be between 0 and %d
+ValueError: posix_setpgid(): Argument #1 ($process_id) must be between 0 and %d
+ValueError: posix_setpgid(): Argument #1 ($process_id) must be between 0 and %d
+ValueError: posix_setpgid(): Argument #2 ($process_group_id) must be between 0 and %d
+ValueError: posix_setpgid(): Argument #2 ($process_group_id) must be between 0 and %d
diff --git a/ext/posix/tests/posix_setrlimit.phpt b/ext/posix/tests/posix_setrlimit.phpt
index 51638793f9d..ea81a944e43 100644
--- a/ext/posix/tests/posix_setrlimit.phpt
+++ b/ext/posix/tests/posix_setrlimit.phpt
@@ -15,22 +15,22 @@
 try {
 	posix_setrlimit(POSIX_RLIMIT_NOFILE, 129, 128);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
 	posix_setrlimit(POSIX_RLIMIT_NOFILE, -2, -1);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
 	posix_setrlimit(POSIX_RLIMIT_NOFILE, -1, -2);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
 bool(true)
-posix_setrlimit(): Argument #2 ($soft_limit) must be lower or equal to 128
-posix_setrlimit(): Argument #2 ($soft_limit) must be greater or equal to -1
-posix_setrlimit(): Argument #3 ($hard_limit) must be greater or equal to -1
+ValueError: posix_setrlimit(): Argument #2 ($soft_limit) must be lower or equal to 128
+ValueError: posix_setrlimit(): Argument #2 ($soft_limit) must be greater or equal to -1
+ValueError: posix_setrlimit(): Argument #3 ($hard_limit) must be greater or equal to -1
diff --git a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
index e35cd637a7f..c00d02143e9 100644
--- a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
+++ b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
@@ -22,9 +22,9 @@
 try {
     var_dump(posix_ttyname($process)); // wrong resource type
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
 bool(false)
-posix_ttyname(): supplied resource is not a valid stream resource
+TypeError: posix_ttyname(): supplied resource is not a valid stream resource
diff --git a/ext/readline/tests/readline_callback_handler_install_001.phpt b/ext/readline/tests/readline_callback_handler_install_001.phpt
index 543a57e657e..d6602403ae0 100644
--- a/ext/readline/tests/readline_callback_handler_install_001.phpt
+++ b/ext/readline/tests/readline_callback_handler_install_001.phpt
@@ -17,10 +17,10 @@ function foo() {
 try {
     var_dump(readline_callback_handler_install('testing: ', 'foobar!'));
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
 testing: bool(true)
-readline_callback_handler_install(): Argument #2 ($callback) must be a valid callback, function "foobar!" not found or invalid function name
+TypeError: readline_callback_handler_install(): Argument #2 ($callback) must be a valid callback, function "foobar!" not found or invalid function name
diff --git a/ext/readline/tests/readline_completion_function_001.phpt b/ext/readline/tests/readline_completion_function_001.phpt
index a1d16a6774f..31d502b7ec7 100644
--- a/ext/readline/tests/readline_completion_function_001.phpt
+++ b/ext/readline/tests/readline_completion_function_001.phpt
@@ -18,7 +18,7 @@ function foo() { }
     try {
         var_dump(readline_completion_function($callback));
     } catch (\TypeError $e) {
-        echo $e->getMessage() . \PHP_EOL;
+        echo $e::class, ': ', $e->getMessage(), PHP_EOL;
     }
 }

@@ -26,5 +26,5 @@ function foo() { }
 --EXPECT--
 bool(true)
 bool(true)
-readline_completion_function(): Argument #1 ($callback) must be a valid callback, no array or string given
-readline_completion_function(): Argument #1 ($callback) must be a valid callback, no array or string given
+TypeError: readline_completion_function(): Argument #1 ($callback) must be a valid callback, no array or string given
+TypeError: readline_completion_function(): Argument #1 ($callback) must be a valid callback, no array or string given
diff --git a/ext/shmop/tests/001.phpt b/ext/shmop/tests/001.phpt
index 71e4065193d..1805838d278 100644
--- a/ext/shmop/tests/001.phpt
+++ b/ext/shmop/tests/001.phpt
@@ -42,7 +42,7 @@
     try {
         shmop_write($shm_id, $write_d1, $written);
     } catch (Error $exception) {
-        echo $exception->getMessage() . "\n";
+        echo $exception::class, ': ', $exception->getMessage(), "\n";
     }

     echo "shm open for read only: ";
@@ -77,7 +77,7 @@
 data in memory is: test #1 of the shmop() extension
 shm open for read only: ok
 data in memory is: test #1 of the shmop() extension
-Read-only segment cannot be written
+Error: Read-only segment cannot be written
 shm open for read only: ok
 shm write test #2: ok
 data in memory is: test #1 of the shmop() extensiontest #2 append data to shared memory segment
diff --git a/ext/shmop/tests/002.phpt b/ext/shmop/tests/002.phpt
index 56aea8fcdcb..5372b0e9546 100644
--- a/ext/shmop/tests/002.phpt
+++ b/ext/shmop/tests/002.phpt
@@ -13,13 +13,13 @@
 try {
     shmop_open(1338, '', 0644, 1024);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     shmop_open(1338, 'b', 0644, 1024);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 // Warning outputs: Unable to attach or create shared memory segment
@@ -29,14 +29,14 @@
 try {
     shmop_open(0, 'a', 0644, 1024);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 //Shared memory segment size must be greater than zero
 try {
     shmop_open(1338, "c", 0666, 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 echo PHP_EOL, '## shmop_read function tests ##', PHP_EOL;
@@ -45,7 +45,7 @@
 try {
     shmop_read($shm_id, -10, 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 shmop_delete($shm_id);

@@ -54,7 +54,7 @@
 try {
     shmop_read($shm_id, 0, -10);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 shmop_delete($shm_id);

@@ -64,24 +64,24 @@
 try {
     shmop_write($shm_id, 'text to try write', -10);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 shmop_delete($shm_id);
 ?>
 --EXPECTF--
 ## shmop_open function tests ##
-shmop_open(): Argument #2 ($mode) must be a valid access mode
-shmop_open(): Argument #2 ($mode) must be a valid access mode
+ValueError: shmop_open(): Argument #2 ($mode) must be a valid access mode
+ValueError: shmop_open(): Argument #2 ($mode) must be a valid access mode

 Warning: shmop_open(): Unable to attach or create shared memory segment "%s" in %s on line %d
 bool(false)

 Warning: shmop_open(): Unable to attach or create shared memory segment "%s" in %s on line %d
-shmop_open(): Argument #4 ($size) must be greater than 0 for the "c" and "n" access modes
+ValueError: shmop_open(): Argument #4 ($size) must be greater than 0 for the "c" and "n" access modes

 ## shmop_read function tests ##
-shmop_read(): Argument #2 ($offset) must be between 0 and the segment size
-shmop_read(): Argument #3 ($size) is out of range
+ValueError: shmop_read(): Argument #2 ($offset) must be between 0 and the segment size
+ValueError: shmop_read(): Argument #3 ($size) is out of range

 ## shmop_write function tests ##
-shmop_write(): Argument #3 ($offset) is out of range
+ValueError: shmop_write(): Argument #3 ($offset) is out of range
diff --git a/ext/shmop/tests/gh9945.phpt b/ext/shmop/tests/gh9945.phpt
index f22f79149bf..1bf117fc08d 100644
--- a/ext/shmop/tests/gh9945.phpt
+++ b/ext/shmop/tests/gh9945.phpt
@@ -12,8 +12,8 @@
 try {
     shmop_open(0x100000000, '', 0644, 1);
 } catch (ValueError $exception) {
-    echo $exception->getMessage(), "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-shmop_open(): Argument #1 ($key) is out of range
+ValueError: shmop_open(): Argument #1 ($key) is out of range
diff --git a/ext/snmp/tests/gh17330.phpt b/ext/snmp/tests/gh17330.phpt
index a6f077a9c86..898b0357fcd 100644
--- a/ext/snmp/tests/gh17330.phpt
+++ b/ext/snmp/tests/gh17330.phpt
@@ -11,8 +11,8 @@
 try {
 	$session->setSecurity('authPriv', 'MD5', '', 'AES', '');
 } catch(Error $e) {
-	echo $e->getMessage();
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-Invalid or uninitialized SNMP object
+Error: Invalid or uninitialized SNMP object
diff --git a/ext/snmp/tests/gh21336.phpt b/ext/snmp/tests/gh21336.phpt
index a4070136e55..745bcb27652 100644
--- a/ext/snmp/tests/gh21336.phpt
+++ b/ext/snmp/tests/gh21336.phpt
@@ -10,32 +10,32 @@
 try {
 	$session->setSecurity('authPriv');
 } catch (ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 // auth passphrase NULL
 try {
 	$session->setSecurity('authNoPriv', 'MD5');
 } catch (ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 // priv protocol NULL
 try {
 	$session->setSecurity('authPriv', 'MD5', 'test12345');
 } catch (ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 // priv passphrase NULL
 try {
 	$session->setSecurity('authPriv', 'MD5', 'test12345', 'AES');
 } catch (ValueError $e) {
-	echo $e->getMessage() . PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-SNMP::setSecurity(): Argument #2 ($authProtocol) cannot be null when security level is "authNoPriv" or "authPriv"
-SNMP::setSecurity(): Argument #3 ($authPassphrase) cannot be null when security level is "authNoPriv" or "authPriv"
-SNMP::setSecurity(): Argument #4 ($privacyProtocol) cannot be null when security level is "authPriv"
-SNMP::setSecurity(): Argument #5 ($privacyPassphrase) cannot be null when security level is "authPriv"
+ValueError: SNMP::setSecurity(): Argument #2 ($authProtocol) cannot be null when security level is "authNoPriv" or "authPriv"
+ValueError: SNMP::setSecurity(): Argument #3 ($authPassphrase) cannot be null when security level is "authNoPriv" or "authPriv"
+ValueError: SNMP::setSecurity(): Argument #4 ($privacyProtocol) cannot be null when security level is "authPriv"
+ValueError: SNMP::setSecurity(): Argument #5 ($privacyPassphrase) cannot be null when security level is "authPriv"
diff --git a/ext/snmp/tests/gh21682.phpt b/ext/snmp/tests/gh21682.phpt
index 36b45503593..584e6b784c5 100644
--- a/ext/snmp/tests/gh21682.phpt
+++ b/ext/snmp/tests/gh21682.phpt
@@ -9,7 +9,7 @@
     serialize($s);
     echo "ERROR: should have thrown\n";
 } catch (\Exception $e) {
-    echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 $s->close();
 ?>
diff --git a/ext/sodium/tests/bug78114.phpt b/ext/sodium/tests/bug78114.phpt
index b988c09ec23..cea157e9965 100644
--- a/ext/sodium/tests/bug78114.phpt
+++ b/ext/sodium/tests/bug78114.phpt
@@ -7,8 +7,8 @@
 try {
     eval('sodium_bin2hex();');
 } catch (Throwable $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-sodium_bin2hex() expects exactly 1 argument, 0 given
+ArgumentCountError: sodium_bin2hex() expects exactly 1 argument, 0 given
diff --git a/ext/sodium/tests/crypto_auth.phpt b/ext/sodium/tests/crypto_auth.phpt
index 8f262414beb..20b7ba7ebad 100644
--- a/ext/sodium/tests/crypto_auth.phpt
+++ b/ext/sodium/tests/crypto_auth.phpt
@@ -16,7 +16,7 @@
     $mac = sodium_crypto_auth($msg, $bad_key);
     echo 'Fail!', PHP_EOL;
 } catch (SodiumException $ex) {
-  echo $ex->getMessage(), PHP_EOL;
+  echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }

 // Flip the first bit
@@ -41,7 +41,7 @@
 ?>
 --EXPECT--
 bool(true)
-sodium_crypto_auth(): Argument #2 ($key) must be SODIUM_CRYPTO_AUTH_KEYBYTES bytes long
+SodiumException: sodium_crypto_auth(): Argument #2 ($key) must be SODIUM_CRYPTO_AUTH_KEYBYTES bytes long
 bool(false)
 bool(false)
 bool(false)
diff --git a/ext/sodium/tests/crypto_box.phpt b/ext/sodium/tests/crypto_box.phpt
index f77ec1601cf..82a392d3260 100644
--- a/ext/sodium/tests/crypto_box.phpt
+++ b/ext/sodium/tests/crypto_box.phpt
@@ -49,7 +49,7 @@
       substr($alice_to_bob_kp, 1)
   );
 } catch (SodiumException $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }

 sodium_memzero($alice_box_kp);
@@ -142,7 +142,7 @@
 bool(true)
 bool(true)
 bool(true)
-sodium_crypto_box(): Argument #3 ($key_pair) must be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes long
+SodiumException: sodium_crypto_box(): Argument #3 ($key_pair) must be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes long
 bool(true)
 string(17) "Hi, this is Alice"
 string(21) "Hi Alice! This is Bob"
diff --git a/ext/sodium/tests/crypto_core_ristretto255.phpt b/ext/sodium/tests/crypto_core_ristretto255.phpt
index f1d20fd22ae..65aa52f3eea 100644
--- a/ext/sodium/tests/crypto_core_ristretto255.phpt
+++ b/ext/sodium/tests/crypto_core_ristretto255.phpt
@@ -78,7 +78,7 @@
 try {
     $multL = sodium_crypto_scalarmult_ristretto255($s, $L);
 } catch (SodiumException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 $s2 = sodium_crypto_scalarmult_ristretto255($r, $s);

@@ -128,6 +128,6 @@
 bool(false)
 string(64) "3066f82a1a747d45120d1740f14358531a8f04bbffe6a819f86dfe50f44a0a46"
 bool(true)
-Result is identity element
+SodiumException: Result is identity element
 bool(true)
 bool(true)
diff --git a/ext/sodium/tests/crypto_scalarmult_ristretto255.phpt b/ext/sodium/tests/crypto_scalarmult_ristretto255.phpt
index 0a21d64075d..3568019cce7 100644
--- a/ext/sodium/tests/crypto_scalarmult_ristretto255.phpt
+++ b/ext/sodium/tests/crypto_scalarmult_ristretto255.phpt
@@ -14,12 +14,12 @@
 try {
     $p = sodium_crypto_scalarmult_ristretto255_base($n);
 } catch (SodiumException $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try {
     $p2 = sodium_crypto_scalarmult_ristretto255($n, $b);
 } catch (SodiumException $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 for ($i = 1; $i < 16; $i++) {
@@ -33,13 +33,13 @@
 try {
     sodium_crypto_scalarmult(substr($n, 1), $p);
 } catch (SodiumException $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-sodium_crypto_scalarmult_ristretto255_base(): Argument #1 ($n) must not be zero
-Result is identity element
+SodiumException: sodium_crypto_scalarmult_ristretto255_base(): Argument #1 ($n) must not be zero
+SodiumException: Result is identity element
 string(64) "e2f2ae0a6abc4e71a884a961c500515f58e30b6aa582dd8db6a65945e08d2d76"
 string(64) "6a493210f7499cd17fecb510ae0cea23a110e8d5b901f8acadd3095c73a3b919"
 string(64) "94741f5d5d52755ece4f23f044ee27d5d1ea1e2bd196b462166b16152a9d0259"
@@ -55,4 +55,4 @@
 string(64) "aa52e000df2e16f55fb1032fc33bc42742dad6bd5a8fc0be0167436c5948501f"
 string(64) "46376b80f409b29dc2b5f6f0c52591990896e5716f41477cd30085ab7f10301e"
 string(64) "e0c418f7c8d9c4cdd7395b93ea124f3ad99021bb681dfc3302a9d99a2e53e64e"
-sodium_crypto_scalarmult(): Argument #1 ($n) must be SODIUM_CRYPTO_SCALARMULT_SCALARBYTES bytes long
+SodiumException: sodium_crypto_scalarmult(): Argument #1 ($n) must be SODIUM_CRYPTO_SCALARMULT_SCALARBYTES bytes long
diff --git a/ext/sodium/tests/crypto_stream_xchacha20.phpt b/ext/sodium/tests/crypto_stream_xchacha20.phpt
index 466734853d7..0db0a4a487c 100644
--- a/ext/sodium/tests/crypto_stream_xchacha20.phpt
+++ b/ext/sodium/tests/crypto_stream_xchacha20.phpt
@@ -53,27 +53,27 @@
 try {
     sodium_crypto_stream_xchacha20(-1, $nonce, $key);
 } catch (SodiumException $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try {
     sodium_crypto_stream_xchacha20($len, substr($nonce, 1), $key);
 } catch (SodiumException $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try {
     sodium_crypto_stream_xchacha20($len, $nonce, substr($key, 1));
 } catch (SodiumException $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try {
     sodium_crypto_stream_xchacha20_xor($stream, substr($nonce, 1), $key);
 } catch (SodiumException $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try {
     sodium_crypto_stream_xchacha20_xor($stream, $nonce, substr($key, 1));
 } catch (SodiumException $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 ?>
@@ -89,8 +89,8 @@
 bool(true)
 int(128)
 bool(true)
-sodium_crypto_stream_xchacha20(): Argument #1 ($length) must be greater than 0
-sodium_crypto_stream_xchacha20(): Argument #2 ($nonce) must be SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES bytes long
-sodium_crypto_stream_xchacha20(): Argument #3 ($key) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long
-sodium_crypto_stream_xchacha20_xor(): Argument #2 ($nonce) must be SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES bytes long
-sodium_crypto_stream_xchacha20_xor(): Argument #3 ($key) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long
+SodiumException: sodium_crypto_stream_xchacha20(): Argument #1 ($length) must be greater than 0
+SodiumException: sodium_crypto_stream_xchacha20(): Argument #2 ($nonce) must be SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES bytes long
+SodiumException: sodium_crypto_stream_xchacha20(): Argument #3 ($key) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long
+SodiumException: sodium_crypto_stream_xchacha20_xor(): Argument #2 ($nonce) must be SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES bytes long
+SodiumException: sodium_crypto_stream_xchacha20_xor(): Argument #3 ($key) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long
diff --git a/ext/sodium/tests/inc_add.phpt b/ext/sodium/tests/inc_add.phpt
index 7652cf851eb..60dae7db9f7 100644
--- a/ext/sodium/tests/inc_add.phpt
+++ b/ext/sodium/tests/inc_add.phpt
@@ -9,7 +9,7 @@
 try {
     sodium_increment($notStr);
 } catch (SodiumException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $str = "abc";
@@ -28,7 +28,7 @@
 try {
     sodium_add($notStr, $addStr);
 } catch (SodiumException $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $str = "abc";
@@ -43,12 +43,12 @@

 ?>
 --EXPECT--
-a PHP string is required
+SodiumException: a PHP string is required
 string(3) "bbc"
 string(3) "abc"
 string(3) "bbc"
 string(3) "abc"
-PHP strings are required
+SodiumException: PHP strings are required
 string(3) "cbc"
 string(3) "abc"
 string(3) "cbc"
diff --git a/ext/sodium/tests/pwhash_memlimit_below_min.phpt b/ext/sodium/tests/pwhash_memlimit_below_min.phpt
index 8913afb382f..68fe135775c 100644
--- a/ext/sodium/tests/pwhash_memlimit_below_min.phpt
+++ b/ext/sodium/tests/pwhash_memlimit_below_min.phpt
@@ -13,15 +13,15 @@
 try {
     sodium_crypto_pwhash(32, "password", $salt, SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, 1);
 } catch (\ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 try {
     sodium_crypto_pwhash_str("password", SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, 1);
 } catch (\ValueError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
-sodium_crypto_pwhash(): Argument #5 ($memlimit) must be greater than or equal to %d
-sodium_crypto_pwhash_str(): Argument #3 ($memlimit) must be greater than or equal to %d
+ValueError: sodium_crypto_pwhash(): Argument #5 ($memlimit) must be greater than or equal to %d
+ValueError: sodium_crypto_pwhash_str(): Argument #3 ($memlimit) must be greater than or equal to %d
diff --git a/ext/sodium/tests/sodium_crypto_sign_ed25519_pk_to_curve25519_failure_leak.phpt b/ext/sodium/tests/sodium_crypto_sign_ed25519_pk_to_curve25519_failure_leak.phpt
index 1e4e74eecbe..c2485cc5e78 100644
--- a/ext/sodium/tests/sodium_crypto_sign_ed25519_pk_to_curve25519_failure_leak.phpt
+++ b/ext/sodium/tests/sodium_crypto_sign_ed25519_pk_to_curve25519_failure_leak.phpt
@@ -8,9 +8,9 @@
 try {
     sodium_crypto_sign_ed25519_pk_to_curve25519(str_repeat("\x00", SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES));
 } catch (SodiumException $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-conversion failed
+SodiumException: conversion failed
diff --git a/ext/sodium/tests/utils.phpt b/ext/sodium/tests/utils.phpt
index 66969a60bdf..f60aa4dbd08 100644
--- a/ext/sodium/tests/utils.phpt
+++ b/ext/sodium/tests/utils.phpt
@@ -102,7 +102,7 @@ function sodium_foo()
 try {
     sodium_foo();
 } catch (SodiumException $ex) {
-    var_dump($ex->getMessage());
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 ?>
@@ -126,4 +126,4 @@ function sodium_foo()
 string(24) "base64("O1") case passed"
 string(23) "base64("O") case passed"
 string(4) "abcd"
-string(4) "test"
+SodiumException: test
diff --git a/ext/sqlite3/tests/bug66550.phpt b/ext/sqlite3/tests/bug66550.phpt
index 60477a0b17a..11548906a5b 100644
--- a/ext/sqlite3/tests/bug66550.phpt
+++ b/ext/sqlite3/tests/bug66550.phpt
@@ -16,8 +16,8 @@
 try {
     $stmt->reset();
 } catch (\Error $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-The SQLite3 object has not been correctly initialised or is already closed
+Error: The SQLite3 object has not been correctly initialised or is already closed
diff --git a/ext/sqlite3/tests/bug68760.phpt b/ext/sqlite3/tests/bug68760.phpt
index c6cc9ed3b1e..cfcc7080b9f 100644
--- a/ext/sqlite3/tests/bug68760.phpt
+++ b/ext/sqlite3/tests/bug68760.phpt
@@ -24,7 +24,7 @@ function oopsFunction($a, $b) {
     $db->close();
 }
 catch(\Exception $e) {
-    echo "Exception: ".$e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
diff --git a/ext/sqlite3/tests/bug72668.phpt b/ext/sqlite3/tests/bug72668.phpt
index 7f33338eb5e..551ec18cae0 100644
--- a/ext/sqlite3/tests/bug72668.phpt
+++ b/ext/sqlite3/tests/bug72668.phpt
@@ -16,14 +16,14 @@ function my_udf_md5($string) {
     var_dump($result);
 }
 catch(\Exception $e) {
-    echo "Exception: ".$e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     $result = $db->querySingle("SELECT my_udf_md5('test')");
     var_dump($result);
 }
 catch(\Exception $e) {
-    echo "Exception: ".$e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 $statement = $db->prepare("SELECT my_udf_md5('test')");
 try {
@@ -31,10 +31,12 @@ function my_udf_md5($string) {
     var_dump($result);
 }
 catch(\Exception $e) {
-    echo "Exception: ".$e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
 Exception: test exception
+
 Exception: test exception
+
 Exception: test exception
diff --git a/ext/sqlite3/tests/bug77051.phpt b/ext/sqlite3/tests/bug77051.phpt
index 7b44516b7fd..7cba3ca8c96 100644
--- a/ext/sqlite3/tests/bug77051.phpt
+++ b/ext/sqlite3/tests/bug77051.phpt
@@ -81,4 +81,4 @@
   string(4) "TEST"
   [2]=>
   string(3) "!!!"
-}
\ No newline at end of file
+}
diff --git a/ext/sqlite3/tests/gh9032.phpt b/ext/sqlite3/tests/gh9032.phpt
index 34ca992ab26..f479cbdfd20 100644
--- a/ext/sqlite3/tests/gh9032.phpt
+++ b/ext/sqlite3/tests/gh9032.phpt
@@ -18,9 +18,9 @@
     $st->execute();
     var_dump($db->exec('create table db2.r (id int)'));
 } catch (SQLite3Exception $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+    echo $ex::class, ': ', $ex->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
 bool(true)
-Unable to prepare statement: not authorized
+SQLite3Exception: Unable to prepare statement: not authorized
diff --git a/ext/sqlite3/tests/gh_sqlite3_escapestring_nul.phpt b/ext/sqlite3/tests/gh_sqlite3_escapestring_nul.phpt
index 49d66a1accf..25fb24e5317 100644
--- a/ext/sqlite3/tests/gh_sqlite3_escapestring_nul.phpt
+++ b/ext/sqlite3/tests/gh_sqlite3_escapestring_nul.phpt
@@ -17,7 +17,7 @@
         SQLite3::escapeString($in);
         echo "FAIL: no exception for ", bin2hex($in), "\n";
     } catch (ValueError $e) {
-        echo "ValueError: ", $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }

diff --git a/ext/sqlite3/tests/sqlite3_02_open.phpt b/ext/sqlite3/tests/sqlite3_02_open.phpt
index 128e8c1b248..a292bc1e7c7 100644
--- a/ext/sqlite3/tests/sqlite3_02_open.phpt
+++ b/ext/sqlite3/tests/sqlite3_02_open.phpt
@@ -11,9 +11,9 @@
 try {
   $db = new SQLite3();
 } catch (TypeError $e) {
-  var_dump($e->getMessage());
+  echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-string(59) "SQLite3::__construct() expects at least 1 argument, 0 given"
+ArgumentCountError: SQLite3::__construct() expects at least 1 argument, 0 given
diff --git a/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt b/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt
index 67037e22695..777aaffe119 100644
--- a/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt
+++ b/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt
@@ -30,7 +30,7 @@
 try {
     var_dump($results->numColumns());
 } catch (\Error $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 echo "Done\n";
 ?>
@@ -50,5 +50,5 @@
 Closing database
 bool(true)
 Check db was closed
-The SQLite3Result object has not been correctly initialised or is already closed
+Error: The SQLite3Result object has not been correctly initialised or is already closed
 Done
diff --git a/ext/sqlite3/tests/sqlite3_31_open.phpt b/ext/sqlite3/tests/sqlite3_31_open.phpt
index 3b5705cb98d..3553c1db3ce 100644
--- a/ext/sqlite3/tests/sqlite3_31_open.phpt
+++ b/ext/sqlite3/tests/sqlite3_31_open.phpt
@@ -12,11 +12,11 @@
   $db = new SQLite3(__DIR__ . '/db1.db');
   $db->open(__DIR__ . '/db1.db');
 } catch (Exception $ex) {
-  var_dump($ex->getMessage());
+  echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 ?>
 --CLEAN--
 <?php @unlink(__DIR__ . '/db1.db'); ?>
 --EXPECT--
-string(29) "Already initialised DB Object"
+Exception: Already initialised DB Object
diff --git a/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt b/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt
index 497c54062dc..7af587f639b 100644
--- a/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt
+++ b/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt
@@ -16,13 +16,13 @@ function aggregate_final ($var) { return $var; }
 try {
     $db->createAggregate('TESTAGGREGATE', 'aggregate_test_step', 'aggregate_final');
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     $db->createAggregate('TESTAGGREGATE2', 'aggregate_step', 'aggregate_test_final');
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 var_dump($db->createAggregate ('TESTAGGREGATE3', 'aggregate_step', 'aggregate_final'));
@@ -32,7 +32,7 @@ function aggregate_final ($var) { return $var; }
 echo "Done"
 ?>
 --EXPECT--
-SQLite3::createAggregate(): Argument #2 ($stepCallback) must be a valid callback, function "aggregate_test_step" not found or invalid function name
-SQLite3::createAggregate(): Argument #3 ($finalCallback) must be a valid callback, function "aggregate_test_final" not found or invalid function name
+TypeError: SQLite3::createAggregate(): Argument #2 ($stepCallback) must be a valid callback, function "aggregate_test_step" not found or invalid function name
+TypeError: SQLite3::createAggregate(): Argument #3 ($finalCallback) must be a valid callback, function "aggregate_test_final" not found or invalid function name
 bool(true)
 Done
diff --git a/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt b/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt
index 0be7469c894..57f6e5f380c 100644
--- a/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt
+++ b/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt
@@ -21,9 +21,9 @@
 try {
   $db->loadExtension("");
 } catch (\Throwable $ex) {
-  var_dump($ex->getMessage());
+  echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 ?>
 --EXPECTF--
-string(63) "SQLite3::loadExtension(): Argument #1 ($name) must not be empty"
+ValueError: SQLite3::loadExtension(): Argument #1 ($name) must not be empty
diff --git a/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt b/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt
index e23d9a8dad8..25280130261 100644
--- a/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt
+++ b/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt
@@ -19,7 +19,7 @@
 try {
   $db->loadExtension("");
 } catch (Extension $ex) {
-  var_dump($ex->getMessage());
+  echo $ex::class, ': ', $ex->getMessage(), "\n";
 }

 ?>
diff --git a/ext/sqlite3/tests/sqlite3_38_backup.phpt b/ext/sqlite3/tests/sqlite3_38_backup.phpt
index 54ca9e95c23..e97ce758b42 100644
--- a/ext/sqlite3/tests/sqlite3_38_backup.phpt
+++ b/ext/sqlite3/tests/sqlite3_38_backup.phpt
@@ -55,4 +55,4 @@
 Backup to DB2 (should fail)

 Warning: SQLite3::backup(): Backup failed: source database is busy in %s on line %d
-bool(false)
\ No newline at end of file
+bool(false)
diff --git a/ext/sqlite3/tests/sqlite3_38_extended_error.phpt b/ext/sqlite3/tests/sqlite3_38_extended_error.phpt
index 433e1efce04..7647980d074 100644
--- a/ext/sqlite3/tests/sqlite3_38_extended_error.phpt
+++ b/ext/sqlite3/tests/sqlite3_38_extended_error.phpt
@@ -33,4 +33,3 @@
 Closing database
 bool(true)
 Done
-
diff --git a/ext/sqlite3/tests/sqlite3_39_toggleExtended.phpt b/ext/sqlite3/tests/sqlite3_39_toggleExtended.phpt
index 135c1cdd109..3e3d290c130 100644
--- a/ext/sqlite3/tests/sqlite3_39_toggleExtended.phpt
+++ b/ext/sqlite3/tests/sqlite3_39_toggleExtended.phpt
@@ -40,4 +40,3 @@
 Closing database
 bool(true)
 Done
-
diff --git a/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt b/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt
index a4f30040334..63d50714715 100644
--- a/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt
+++ b/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt
@@ -23,7 +23,7 @@
     // This one should fail
     var_dump($db->querySingle('CREATE TABLE test (a, b);'));
 } catch (\Exception $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 // Test disabling the authorizer
@@ -53,7 +53,7 @@
 try {
     var_dump($db->querySingle('SELECT 1;'));
 } catch (\Exception $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
     echo $e->getPrevious()->getMessage() . "\n";
 }

@@ -64,14 +64,14 @@
 try {
     var_dump($db->querySingle('SELECT 1;'));
 } catch (\Exception $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
     echo $e->getPrevious()->getMessage() . "\n";
 }

 ?>
 --EXPECT--
 int(1)
-Unable to prepare statement: not authorized
+SQLite3Exception: Unable to prepare statement: not authorized
 bool(true)
 int(42)
 string(6) "SELECT"
@@ -98,7 +98,7 @@
 string(4) "READ"
 string(28) "sqlite_master,rootpage,main,"
 bool(true)
-Unable to prepare statement: not authorized
+SQLite3Exception: Unable to prepare statement: not authorized
 The authorizer callback returned an invalid type: expected int
-Unable to prepare statement: not authorized
+SQLite3Exception: Unable to prepare statement: not authorized
 The authorizer callback returned an invalid value: 4200
diff --git a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
index a072f31c947..4669f57ded1 100644
--- a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
+++ b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
@@ -13,7 +13,7 @@
 try{
     $db->query("SELECT * FROM non_existent_table");
 } catch(Exception $e) {
-    echo $e->getMessage().PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 var_dump($db->enableExceptions(false));
 $db->query("SELECT * FROM non_existent_table");
@@ -23,7 +23,7 @@
 ?>
 --EXPECTF--
 bool(false)
-no such table: non_existent_table
+SQLite3Exception: no such table: non_existent_table

 Deprecated: SQLite3::enableExceptions(): Use of warnings for SQLite3 is deprecated in %s
 bool(true)
diff --git a/ext/sqlite3/tests/sqlite3_explain.phpt b/ext/sqlite3/tests/sqlite3_explain.phpt
index 1f9d4fc940e..710e6a51fbe 100644
--- a/ext/sqlite3/tests/sqlite3_explain.phpt
+++ b/ext/sqlite3/tests/sqlite3_explain.phpt
@@ -41,13 +41,13 @@
 try {
     $stmts->setExplain(-1);
 } catch (\ValueError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     $stmts->setExplain(256);
 } catch (\ValueError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 var_dump($stmts->explain() == Sqlite3Stmt::EXPLAIN_MODE_PREPARED);
@@ -385,6 +385,6 @@
     string(13) "second_insert"
   }
 }
-SQLite3Stmt::setExplain(): Argument #1 ($mode) must be one of the SQLite3Stmt::EXPLAIN_MODE_* constants
-SQLite3Stmt::setExplain(): Argument #1 ($mode) must be one of the SQLite3Stmt::EXPLAIN_MODE_* constants
+ValueError: SQLite3Stmt::setExplain(): Argument #1 ($mode) must be one of the SQLite3Stmt::EXPLAIN_MODE_* constants
+ValueError: SQLite3Stmt::setExplain(): Argument #1 ($mode) must be one of the SQLite3Stmt::EXPLAIN_MODE_* constants
 bool(true)
diff --git a/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer.phpt b/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer.phpt
index 9a89d36f8e6..9793dcc230e 100644
--- a/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer.phpt
+++ b/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer.phpt
@@ -30,7 +30,7 @@ public function __call(string $name, array $arguments) {
     // This one should fail
     var_dump($db->querySingle('CREATE TABLE test (a, b);'));
 } catch (\Exception $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
@@ -38,4 +38,4 @@ public function __call(string $name, array $arguments) {
 Trampoline for authorizer
 int(1)
 Trampoline for authorizer
-Unable to prepare statement: not authorized
+SQLite3Exception: Unable to prepare statement: not authorized
diff --git a/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer_null.phpt b/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer_null.phpt
index 2cea279f077..d0fbc16a7d2 100644
--- a/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer_null.phpt
+++ b/ext/sqlite3/tests/sqlite3_trampoline_setauthorizer_null.phpt
@@ -17,7 +17,7 @@
     // This one should fail
     var_dump($db->querySingle('CREATE TABLE test (a, b);'));
 } catch (\Exception $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
diff --git a/ext/sysvmsg/tests/005.phpt b/ext/sysvmsg/tests/005.phpt
index ec36c85b75f..a38761ebffb 100644
--- a/ext/sysvmsg/tests/005.phpt
+++ b/ext/sysvmsg/tests/005.phpt
@@ -31,7 +31,7 @@
     try {
         msg_receive($q, 0, $null, 0, $msg);
     } catch (ValueError $exception) {
-        echo $exception->getMessage() . "\n";
+        echo $exception::class, ': ', $exception->getMessage(), "\n";
     }

     var_dump(msg_send($q, 1, 'foo', true, true, $errno));
@@ -46,7 +46,7 @@
 bool(false)
 bool(false)
 bool(true)
-msg_receive(): Argument #4 ($max_message_size) must be greater than 0
+ValueError: msg_receive(): Argument #4 ($max_message_size) must be greater than 0

 Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d
 bool(false)
@@ -56,7 +56,7 @@
 bool(false)
 bool(false)
 bool(true)
-msg_receive(): Argument #4 ($max_message_size) must be greater than 0
+ValueError: msg_receive(): Argument #4 ($max_message_size) must be greater than 0

 Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d
 bool(false)
diff --git a/ext/sysvmsg/tests/006.phpt b/ext/sysvmsg/tests/006.phpt
index ae608c6c1fb..3e59d4a5cd8 100644
--- a/ext/sysvmsg/tests/006.phpt
+++ b/ext/sysvmsg/tests/006.phpt
@@ -14,7 +14,7 @@
     try {
         var_dump(msg_send($queue, 1, $elem, false));
     } catch (TypeError $exception) {
-        echo $exception->getMessage() . "\n";
+        echo $exception::class, ': ', $exception->getMessage(), "\n";
     }

     unset($msg);
@@ -57,12 +57,12 @@
 bool(true)
 bool(false)
 Sending/receiving '':
-msg_send(): Argument #3 ($message) must be of type string|int|float|bool, null given
+TypeError: msg_send(): Argument #3 ($message) must be of type string|int|float|bool, null given
 bool(false)
 bool(true)
 bool(false)
 Sending/receiving 'Array':
-msg_send(): Argument #3 ($message) must be of type string|int|float|bool, array given
+TypeError: msg_send(): Argument #3 ($message) must be of type string|int|float|bool, array given
 bool(false)
 bool(false)
 bool(false)
diff --git a/ext/sysvmsg/tests/gh16592.phpt b/ext/sysvmsg/tests/gh16592.phpt
index d48927b4dfe..57393e360fe 100644
--- a/ext/sysvmsg/tests/gh16592.phpt
+++ b/ext/sysvmsg/tests/gh16592.phpt
@@ -13,10 +13,10 @@ function __serialize() {}
 try {
 	msg_send($q, 1, new Test, true);
 } catch (\TypeError $e) {
-	echo $e->getMessage();
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 } finally {
 	msg_remove_queue($q);
 }
 ?>
 --EXPECT--
-Test::__serialize() must return an array
+TypeError: Test::__serialize() must return an array
diff --git a/ext/sysvmsg/tests/gh9945.phpt b/ext/sysvmsg/tests/gh9945.phpt
index e346bde9fc2..6f6158e81c3 100644
--- a/ext/sysvmsg/tests/gh9945.phpt
+++ b/ext/sysvmsg/tests/gh9945.phpt
@@ -12,13 +12,13 @@
 try {
     msg_queue_exists(0x100000000);
 } catch (ValueError $exception) {
-    echo $exception::class, ": ", $exception->getMessage(), "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     msg_get_queue(0x100000000);
 } catch (ValueError $exception) {
-    echo $exception::class, ": ", $exception->getMessage(), "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 ?>
 --EXPECT--
diff --git a/ext/sysvsem/tests/gh9945.phpt b/ext/sysvsem/tests/gh9945.phpt
index a7959eb2156..57791692b52 100644
--- a/ext/sysvsem/tests/gh9945.phpt
+++ b/ext/sysvsem/tests/gh9945.phpt
@@ -12,7 +12,7 @@
 try {
     sem_get(0x100000000);
 } catch (ValueError $exception) {
-    echo $exception::class, ": ", $exception->getMessage(), "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 ?>
 --EXPECT--
diff --git a/ext/sysvshm/tests/001.phpt b/ext/sysvshm/tests/001.phpt
index 10b258da2d0..f97ff5eb0b3 100644
--- a/ext/sysvshm/tests/001.phpt
+++ b/ext/sysvshm/tests/001.phpt
@@ -13,19 +13,19 @@
 try {
     ftok("","");
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     ftok(-1, -1);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     ftok("qwertyu","qwertyu");
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 var_dump(ftok("nonexistentfile","q"));
@@ -35,9 +35,9 @@
 echo "Done\n";
 ?>
 --EXPECTF--
-ftok(): Argument #1 ($filename) must not be empty
-ftok(): Argument #2 ($project_id) must be a single character
-ftok(): Argument #2 ($project_id) must be a single character
+ValueError: ftok(): Argument #1 ($filename) must not be empty
+ValueError: ftok(): Argument #2 ($project_id) must be a single character
+ValueError: ftok(): Argument #2 ($project_id) must be a single character

 Warning: ftok(): ftok() failed - No such file or directory in %s on line %d
 int(-1)
diff --git a/ext/sysvshm/tests/002.phpt b/ext/sysvshm/tests/002.phpt
index d9a91c580e9..2521a388cfd 100644
--- a/ext/sysvshm/tests/002.phpt
+++ b/ext/sysvshm/tests/002.phpt
@@ -15,31 +15,31 @@
 try {
     shm_attach(-1, 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     shm_attach(0, -1);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     shm_attach(123, -1);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     shm_attach($key, -1);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     shm_attach($key, 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 var_dump($s = shm_attach($key, 1024));
@@ -57,11 +57,11 @@
 echo "Done\n";
 ?>
 --EXPECTF--
-shm_attach(): Argument #2 ($size) must be greater than 0
-shm_attach(): Argument #2 ($size) must be greater than 0
-shm_attach(): Argument #2 ($size) must be greater than 0
-shm_attach(): Argument #2 ($size) must be greater than 0
-shm_attach(): Argument #2 ($size) must be greater than 0
+ValueError: shm_attach(): Argument #2 ($size) must be greater than 0
+ValueError: shm_attach(): Argument #2 ($size) must be greater than 0
+ValueError: shm_attach(): Argument #2 ($size) must be greater than 0
+ValueError: shm_attach(): Argument #2 ($size) must be greater than 0
+ValueError: shm_attach(): Argument #2 ($size) must be greater than 0
 object(SysvSharedMemory)#%d (0) {
 }
 object(SysvSharedMemory)#%d (0) {
diff --git a/ext/sysvshm/tests/003.phpt b/ext/sysvshm/tests/003.phpt
index 1d842fb9275..4fbdb918966 100644
--- a/ext/sysvshm/tests/003.phpt
+++ b/ext/sysvshm/tests/003.phpt
@@ -18,13 +18,13 @@
 try {
     shm_detach($s);
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

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

 echo "Done\n";
@@ -39,6 +39,6 @@
 ?>
 --EXPECT--
 bool(true)
-Shared memory block has already been destroyed
-Shared memory block has already been destroyed
+Error: Shared memory block has already been destroyed
+Error: Shared memory block has already been destroyed
 Done
diff --git a/ext/sysvshm/tests/006.phpt b/ext/sysvshm/tests/006.phpt
index edbf9288acc..35da41adc54 100644
--- a/ext/sysvshm/tests/006.phpt
+++ b/ext/sysvshm/tests/006.phpt
@@ -16,7 +16,7 @@
 try {
     shm_put_var($s, 1, "test string");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 var_dump(shm_remove_var($s, -10));
diff --git a/ext/sysvshm/tests/007.phpt b/ext/sysvshm/tests/007.phpt
index 544c39deb00..da0ebfb89e6 100644
--- a/ext/sysvshm/tests/007.phpt
+++ b/ext/sysvshm/tests/007.phpt
@@ -19,12 +19,12 @@
 try {
     shm_remove($s);
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 echo "Done\n";
 ?>
 --EXPECT--
 bool(true)
-Shared memory block has already been destroyed
+Error: Shared memory block has already been destroyed
 Done
diff --git a/ext/sysvshm/tests/gh16591.phpt b/ext/sysvshm/tests/gh16591.phpt
index fb1c58168f5..031b2095672 100644
--- a/ext/sysvshm/tests/gh16591.phpt
+++ b/ext/sysvshm/tests/gh16591.phpt
@@ -19,11 +19,11 @@ function __serialize(): array {
 try {
     shm_put_var($mem, 1, new C);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 } finally {
     shm_remove($cleanup);
 }

 ?>
 --EXPECT--
-Shared memory block has been destroyed by the serialization function
+Error: Shared memory block has been destroyed by the serialization function
diff --git a/ext/sysvshm/tests/gh9945.phpt b/ext/sysvshm/tests/gh9945.phpt
index 8185d39b098..cc53e5e1eaf 100644
--- a/ext/sysvshm/tests/gh9945.phpt
+++ b/ext/sysvshm/tests/gh9945.phpt
@@ -12,8 +12,8 @@
 try {
     shm_attach(0x100000000, 0);
 } catch (ValueError $exception) {
-    echo $exception->getMessage(), "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-shm_attach(): Argument #1 ($key) is out of range
+ValueError: shm_attach(): Argument #1 ($key) is out of range
diff --git a/ext/sysvshm/tests/serialize_exception.phpt b/ext/sysvshm/tests/serialize_exception.phpt
index aae237e0fb3..a311600ec22 100644
--- a/ext/sysvshm/tests/serialize_exception.phpt
+++ b/ext/sysvshm/tests/serialize_exception.phpt
@@ -17,11 +17,11 @@ public function __serialize() {
 try {
     shm_put_var($s, 1, new Test);
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 shm_remove($s);

 ?>
 --EXPECT--
-no
+Error: no
diff --git a/ext/tidy/tests/007.phpt b/ext/tidy/tests/007.phpt
index fbb3731b1d0..09acb879dd2 100644
--- a/ext/tidy/tests/007.phpt
+++ b/ext/tidy/tests/007.phpt
@@ -17,13 +17,13 @@
 try {
     $a->getopt('bogus-opt');
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     tidy_getopt($a, 'non-ASCII string ���');
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 ?>
@@ -31,5 +31,5 @@
 Current Value of 'tidy-mark': bool(false)
 Current Value of 'error-file': string(0) ""
 Current Value of 'tab-size': int(8)
-tidy::getOpt(): Argument #1 ($option) is an invalid configuration option, "bogus-opt" given
-tidy_getopt(): Argument #2 ($option) is an invalid configuration option, "non-ASCII string ���" given
+ValueError: tidy::getOpt(): Argument #1 ($option) is an invalid configuration option, "bogus-opt" given
+ValueError: tidy_getopt(): Argument #2 ($option) is an invalid configuration option, "non-ASCII string ���" given
diff --git a/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt
index 9bf6cf6349a..411719cce25 100644
--- a/ext/tidy/tests/019.phpt
+++ b/ext/tidy/tests/019.phpt
@@ -15,12 +15,12 @@
 try {
     tidy_repair_file($s, $l, $l, $l);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     tidy_repair_file($s, $s, $s, $s);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 tidy_repair_file($l, $l, $l ,$l); // This doesn't emit any warning, TODO look into
@@ -37,6 +37,6 @@
 Warning: tidy_repair_string(): Could not load the Tidy configuration file "1" in %s on line %d

 Warning: tidy_repair_string(): Could not set encoding "1" in %s on line %d
-Path must not be empty
-Path must not be empty
+ValueError: Path must not be empty
+ValueError: Path must not be empty
 Done
diff --git a/ext/tidy/tests/021.phpt b/ext/tidy/tests/021.phpt
index f4c2a99017f..22e351e4d9d 100644
--- a/ext/tidy/tests/021.phpt
+++ b/ext/tidy/tests/021.phpt
@@ -10,7 +10,7 @@
 try {
     tidy_get_opt_doc(new tidy, 'some_bogus_cfg');
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 $t = new tidy;
@@ -18,6 +18,6 @@
 var_dump(strlen(tidy_get_opt_doc($t, 'wrap')) > 99);
 ?>
 --EXPECT--
-tidy_get_opt_doc(): Argument #2 ($option) is an invalid configuration option, "some_bogus_cfg" given
+ValueError: tidy_get_opt_doc(): Argument #2 ($option) is an invalid configuration option, "some_bogus_cfg" given
 string(73) "This option specifies if Tidy should allow numeric character references. "
 bool(true)
diff --git a/ext/tidy/tests/036.phpt b/ext/tidy/tests/036.phpt
index d328c4862fe..0de72c10c6b 100644
--- a/ext/tidy/tests/036.phpt
+++ b/ext/tidy/tests/036.phpt
@@ -11,65 +11,65 @@
 try {
     $node->value = "";
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     $node->name = "";
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     $node->type = 1;
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     $node->line = 1;
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     $node->column = 1;
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     $node->proprietary = true;
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     $node->id = null;
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     $node->attribute = [];
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     $node->child = [];
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Cannot modify readonly property tidyNode::$value
-Cannot modify readonly property tidyNode::$name
-Cannot modify readonly property tidyNode::$type
-Cannot modify readonly property tidyNode::$line
-Cannot modify readonly property tidyNode::$column
-Cannot modify readonly property tidyNode::$proprietary
-Cannot modify readonly property tidyNode::$id
-Cannot modify readonly property tidyNode::$attribute
-Cannot modify readonly property tidyNode::$child
+Error: Cannot modify readonly property tidyNode::$value
+Error: Cannot modify readonly property tidyNode::$name
+Error: Cannot modify readonly property tidyNode::$type
+Error: Cannot modify readonly property tidyNode::$line
+Error: Cannot modify readonly property tidyNode::$column
+Error: Cannot modify readonly property tidyNode::$proprietary
+Error: Cannot modify readonly property tidyNode::$id
+Error: Cannot modify readonly property tidyNode::$attribute
+Error: Cannot modify readonly property tidyNode::$child
diff --git a/ext/tidy/tests/bug77040.phpt b/ext/tidy/tests/bug77040.phpt
index 417c5e5f892..a4f4c1613aa 100644
--- a/ext/tidy/tests/bug77040.phpt
+++ b/ext/tidy/tests/bug77040.phpt
@@ -22,4 +22,4 @@
 bool(true)
 bool(false)
 bool(true)
-bool(false)
\ No newline at end of file
+bool(false)
diff --git a/ext/tidy/tests/gh20374.phpt b/ext/tidy/tests/gh20374.phpt
index 73299856b08..fb7bca73ee6 100644
--- a/ext/tidy/tests/gh20374.phpt
+++ b/ext/tidy/tests/gh20374.phpt
@@ -50,7 +50,7 @@ public function __toString(): string {
         $tidy->parseString($str, $config, 'utf8');
         echo $tidy->value, "\n";
     } catch (Throwable $e) {
-        echo $e::class, ": ", $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }

diff --git a/ext/tidy/tests/gh21682.phpt b/ext/tidy/tests/gh21682.phpt
index 33ec0045961..f1b7bce1ff0 100644
--- a/ext/tidy/tests/gh21682.phpt
+++ b/ext/tidy/tests/gh21682.phpt
@@ -9,7 +9,7 @@
     serialize($t);
     echo "ERROR: should have thrown\n";
 } catch (\Exception $e) {
-    echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 $t->parseString("<html><body>test</body></html>");
@@ -18,7 +18,7 @@
     serialize($node);
     echo "ERROR: should have thrown\n";
 } catch (\Exception $e) {
-    echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
diff --git a/ext/tidy/tests/open_basedir_failure_config.phpt b/ext/tidy/tests/open_basedir_failure_config.phpt
index 3b12c9e4ea8..e7bdfd46f88 100644
--- a/ext/tidy/tests/open_basedir_failure_config.phpt
+++ b/ext/tidy/tests/open_basedir_failure_config.phpt
@@ -20,7 +20,7 @@
 try {
     $tidy = new tidy(__DIR__.'/open_basedir/test.html', 'my_config_file.ini');
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "=== parseFile ===\n";
@@ -42,7 +42,7 @@

 Warning: tidy_parse_file(): open_basedir restriction in effect. File(my_config_file.ini) is not within the allowed path(s): (%sopen_basedir) in %s on line %d
 === __construct ===
-tidy::__construct(): open_basedir restriction in effect. File(my_config_file.ini) is not within the allowed path(s): (%sopen_basedir)
+Exception: tidy::__construct(): open_basedir restriction in effect. File(my_config_file.ini) is not within the allowed path(s): (%sopen_basedir)
 === parseFile ===

 Warning: tidy::parseFile(): open_basedir restriction in effect. File(my_config_file.ini) is not within the allowed path(s): (%sopen_basedir) in %s on line %d
diff --git a/ext/tidy/tests/parsing_inexistent_file.phpt b/ext/tidy/tests/parsing_inexistent_file.phpt
index e5f73c5388c..ca969068350 100644
--- a/ext/tidy/tests/parsing_inexistent_file.phpt
+++ b/ext/tidy/tests/parsing_inexistent_file.phpt
@@ -13,7 +13,7 @@
 try {
     $tidy = new tidy("does_not_exist.html");
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
@@ -22,4 +22,4 @@

 Warning: tidy_parse_file(): Cannot load "does_not_exist.html" into memory in %s on line %d
 bool(false)
-Cannot load "does_not_exist.html" into memory
+Exception: Cannot load "does_not_exist.html" into memory
diff --git a/ext/tidy/tests/tidy_error1.phpt b/ext/tidy/tests/tidy_error1.phpt
index 5e7593762a9..e565db3aece 100644
--- a/ext/tidy/tests/tidy_error1.phpt
+++ b/ext/tidy/tests/tidy_error1.phpt
@@ -14,14 +14,14 @@
 try {
 	$tidy->parseString($buffer, $config);
 } catch (\ValueError $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 $config = ['neither'];
 try {
 	$tidy->parseString($buffer, $config);
 } catch (\TypeError $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 $config = ['doctype-mode' => 'customtag'];
@@ -29,7 +29,7 @@
 try {
 	var_dump($tidy->parseString($buffer, $config));
 } catch (\ValueError $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 $config = ['doctype' => 'php'];
@@ -37,7 +37,7 @@
 try {
 	var_dump($tidy->parseString($buffer, $config));
 } catch (\TypeError $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 $config = ['doctype' => 'auto', 0 => 'value2'];
@@ -45,7 +45,7 @@
 try {
 	var_dump($tidy->parseString($buffer, $config));
 } catch (\TypeError $e) {
-	echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
diff --git a/ext/tidy/tests/uninitialized.phpt b/ext/tidy/tests/uninitialized.phpt
index 7793f9725b1..38dd124c962 100644
--- a/ext/tidy/tests/uninitialized.phpt
+++ b/ext/tidy/tests/uninitialized.phpt
@@ -9,21 +9,21 @@
 try {
     var_dump($tidy->getHtmlVer());
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($tidy->isXhtml());
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump($tidy->isXml());
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-tidy object is not initialized
-tidy object is not initialized
-tidy object is not initialized
+Error: tidy object is not initialized
+Error: tidy object is not initialized
+Error: tidy object is not initialized
diff --git a/ext/tokenizer/tests/PhpToken_extension_errors.phpt b/ext/tokenizer/tests/PhpToken_extension_errors.phpt
index c0676c6b795..241bdae6157 100644
--- a/ext/tokenizer/tests/PhpToken_extension_errors.phpt
+++ b/ext/tokenizer/tests/PhpToken_extension_errors.phpt
@@ -12,7 +12,7 @@ class MyPhpToken1 extends PhpToken {
 try {
     var_dump(MyPhpToken1::tokenize("<?php foo"));
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 abstract class MyPhpToken2 extends PhpToken {
@@ -21,10 +21,10 @@ abstract class MyPhpToken2 extends PhpToken {
 try {
     var_dump(MyPhpToken2::tokenize("<?php foo"));
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Undefined constant "UNKNOWN"
-Cannot instantiate abstract class MyPhpToken2
+Error: Undefined constant "UNKNOWN"
+Error: Cannot instantiate abstract class MyPhpToken2
diff --git a/ext/tokenizer/tests/PhpToken_methods.phpt b/ext/tokenizer/tests/PhpToken_methods.phpt
index 13aee985693..80d149f6ddf 100644
--- a/ext/tokenizer/tests/PhpToken_methods.phpt
+++ b/ext/tokenizer/tests/PhpToken_methods.phpt
@@ -40,12 +40,12 @@ function foo() {
 try {
     $token->is(3.141);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $token->is([3.141]);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 unset($token->id);
@@ -53,22 +53,22 @@ function foo() {
 try {
     $token->is(T_FUNCTION);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $token->is('function');
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $token->is([T_FUNCTION]);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     $token->is(['function']);
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "\nName of unknown token:\n";
@@ -110,12 +110,12 @@ function foo() {
 bool(false)

 Error:
-PhpToken::is(): Argument #1 ($kind) must be of type string|int|array, float given
-PhpToken::is(): Argument #1 ($kind) must only have elements of type string|int, float given
-Typed property PhpToken::$id must not be accessed before initialization
-Typed property PhpToken::$text must not be accessed before initialization
-Typed property PhpToken::$id must not be accessed before initialization
-Typed property PhpToken::$text must not be accessed before initialization
+TypeError: PhpToken::is(): Argument #1 ($kind) must be of type string|int|array, float given
+TypeError: PhpToken::is(): Argument #1 ($kind) must only have elements of type string|int, float given
+Error: Typed property PhpToken::$id must not be accessed before initialization
+Error: Typed property PhpToken::$text must not be accessed before initialization
+Error: Typed property PhpToken::$id must not be accessed before initialization
+Error: Typed property PhpToken::$text must not be accessed before initialization

 Name of unknown token:
 NULL
diff --git a/ext/tokenizer/tests/parse_errors.phpt b/ext/tokenizer/tests/parse_errors.phpt
index 2985272b374..9e44105e924 100644
--- a/ext/tokenizer/tests/parse_errors.phpt
+++ b/ext/tokenizer/tests/parse_errors.phpt
@@ -9,7 +9,7 @@ function test_parse_error($code) {
     try {
         var_dump(token_get_all($code, TOKEN_PARSE));
     } catch (ParseError $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }

     foreach (token_get_all($code) as $token) {
@@ -29,7 +29,7 @@ function test_parse_error($code) {

 ?>
 --EXPECT--
-Invalid numeric literal
+ParseError: Invalid numeric literal
 T_OPEN_TAG (<?php )
 T_STRING (var_dump)
 (
@@ -37,7 +37,7 @@ function test_parse_error($code) {
 )
 ;

-Invalid UTF-8 codepoint escape sequence
+ParseError: Invalid UTF-8 codepoint escape sequence
 T_OPEN_TAG (<?php )
 T_STRING (var_dump)
 (
@@ -45,7 +45,7 @@ function test_parse_error($code) {
 )
 ;

-Invalid UTF-8 codepoint escape sequence: Codepoint too large
+ParseError: Invalid UTF-8 codepoint escape sequence: Codepoint too large
 T_OPEN_TAG (<?php )
 T_STRING (var_dump)
 (
@@ -53,7 +53,7 @@ function test_parse_error($code) {
 )
 ;

-Invalid numeric literal
+ParseError: Invalid numeric literal
 T_OPEN_TAG (<?php )
 T_STRING (var_dump)
 (
diff --git a/ext/tokenizer/tests/token_get_all_TOKEN_PARSE_000.phpt b/ext/tokenizer/tests/token_get_all_TOKEN_PARSE_000.phpt
index 4139ffbeed1..5fcd7547929 100644
--- a/ext/tokenizer/tests/token_get_all_TOKEN_PARSE_000.phpt
+++ b/ext/tokenizer/tests/token_get_all_TOKEN_PARSE_000.phpt
@@ -8,12 +8,12 @@
 try {
     token_get_all('<?php invalid code;', TOKEN_PARSE);
 } catch (ParseError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 echo "Done";

 ?>
 --EXPECT--
-syntax error, unexpected identifier "code"
+ParseError: syntax error, unexpected identifier "code"
 Done
diff --git a/ext/tokenizer/tests/token_get_all_heredoc_nowdoc.phpt b/ext/tokenizer/tests/token_get_all_heredoc_nowdoc.phpt
index 6b3010d7cf4..62fc1a9c74b 100644
--- a/ext/tokenizer/tests/token_get_all_heredoc_nowdoc.phpt
+++ b/ext/tokenizer/tests/token_get_all_heredoc_nowdoc.phpt
@@ -15,7 +15,7 @@ function test(string $code, int $flags)
             }
         }
     } catch (ParseError $e) {
-        echo "Parse error: {$e->getMessage()} on line {$e->getLine()}\n";
+        echo $e::class, ': ', $e->getMessage(), ' on line ', $e->getLine(), "\n";
     }
 }

@@ -326,11 +326,11 @@ function test(string $code, int $flags)

 Test case 5

-Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 2
+ParseError: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 2

 Test case 6

-Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 2
+ParseError: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 2

 Test case 7

@@ -343,7 +343,7 @@ function test(string $code, int $flags)

 Test case 8

-Parse error: Invalid indentation - tabs and spaces cannot be mixed on line 3
+ParseError: Invalid indentation - tabs and spaces cannot be mixed on line 3

 Test case 9

@@ -365,7 +365,7 @@ function test(string $code, int $flags)

 Test case 11

-Parse error: Invalid body indentation level (expecting an indentation level of at least 3) on line 2
+ParseError: Invalid body indentation level (expecting an indentation level of at least 3) on line 2

 Test case 12

@@ -396,7 +396,7 @@ function test(string $code, int $flags)

 Test case 15

-Parse error: Invalid body indentation level (expecting an indentation level of at least 3) on line 2
+ParseError: Invalid body indentation level (expecting an indentation level of at least 3) on line 2

 Test case 16

@@ -409,8 +409,8 @@ function test(string $code, int $flags)

 Test case 17

-Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 4
+ParseError: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 4

 Test case 18

-Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 4
+ParseError: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" on line 4
diff --git a/ext/zend_test/tests/gh13970.phpt b/ext/zend_test/tests/gh13970.phpt
index f6b68f89702..bdf6d0891fc 100644
--- a/ext/zend_test/tests/gh13970.phpt
+++ b/ext/zend_test/tests/gh13970.phpt
@@ -15,8 +15,8 @@ function test() {}
 try {
     var_dump($reflection->getAttributes()[0]->newInstance());
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Attribute::__construct(): Argument #1 ($flags) must be of type int, ZendTestUnitEnum given
+Error: Attribute::__construct(): Argument #1 ($flags) must be of type int, ZendTestUnitEnum given
diff --git a/ext/zend_test/tests/gh14741.phpt b/ext/zend_test/tests/gh14741.phpt
index 389692f3de2..c9b064d3207 100644
--- a/ext/zend_test/tests/gh14741.phpt
+++ b/ext/zend_test/tests/gh14741.phpt
@@ -9,9 +9,9 @@
 try {
     clone $it;
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Trying to clone an uncloneable object of class InternalIterator
+Error: Trying to clone an uncloneable object of class InternalIterator
 TraversableTest::drop
diff --git a/ext/zend_test/tests/gh16266.phpt b/ext/zend_test/tests/gh16266.phpt
index 44cb7ef807c..ed755515d7f 100644
--- a/ext/zend_test/tests/gh16266.phpt
+++ b/ext/zend_test/tests/gh16266.phpt
@@ -8,14 +8,14 @@
     $o = new _ZendTestClass();
     $o->test('a', 'b', c: 'c');
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     _ZendTestClass::test('a', 'b', c: 'c');
 } catch (Error $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Unknown named parameter $c
-Unknown named parameter $c
+Error: Unknown named parameter $c
+Error: Unknown named parameter $c
diff --git a/ext/zend_test/tests/gh17899.phpt b/ext/zend_test/tests/gh17899.phpt
index 58f445a3b7b..8d8ac963227 100644
--- a/ext/zend_test/tests/gh17899.phpt
+++ b/ext/zend_test/tests/gh17899.phpt
@@ -32,4 +32,3 @@
   thrown in <?php
 require("sumfile.php");
 ?> on line %d
-
diff --git a/ext/zend_test/tests/gh19720.phpt b/ext/zend_test/tests/gh19720.phpt
index 627444c4793..fabdcaf7051 100644
--- a/ext/zend_test/tests/gh19720.phpt
+++ b/ext/zend_test/tests/gh19720.phpt
@@ -15,8 +15,8 @@ class Test {
 try {
     var_dump(Test::MyConst);
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Constant ZEND_TEST_DEPRECATED is deprecated
+Exception: Constant ZEND_TEST_DEPRECATED is deprecated
diff --git a/ext/zend_test/tests/gh22169.phpt b/ext/zend_test/tests/gh22169.phpt
index 5ed2ab22fa2..2511a36f045 100644
--- a/ext/zend_test/tests/gh22169.phpt
+++ b/ext/zend_test/tests/gh22169.phpt
@@ -19,4 +19,3 @@
 string(44) "424547494e200a0d090b1b0c5c242241414120454e44"
 string(43) "BEGIN \n\r\t\v\e\f\\\\$\"\101\x41\u{41} END"
 string(14) "begin $ \$ end"
-
diff --git a/ext/zend_test/tests/internal_dnf_arguments.phpt b/ext/zend_test/tests/internal_dnf_arguments.phpt
index eb6f5fb514f..47f0aba19d1 100644
--- a/ext/zend_test/tests/internal_dnf_arguments.phpt
+++ b/ext/zend_test/tests/internal_dnf_arguments.phpt
@@ -15,7 +15,7 @@
 try {
     zend_test_internal_dnf_arguments(new stdClass);
 } catch (\Throwable $err) {
-    echo $err->getMessage(), "\n";
+    echo $err::class, ': ', $err->getMessage(), "\n";
 }

 $obj = new \ArrayIterator([]);
@@ -26,7 +26,7 @@
 --EXPECT--
 string(32) "Iterator|(Traversable&Countable)"
 string(32) "Iterator|(Traversable&Countable)"
-zend_test_internal_dnf_arguments(): Argument #1 ($arg) must be of type Iterator|(Traversable&Countable), stdClass given
+TypeError: zend_test_internal_dnf_arguments(): Argument #1 ($arg) must be of type Iterator|(Traversable&Countable), stdClass given
 object(ArrayIterator)#5 (1) {
   ["storage":"ArrayIterator":private]=>
   array(0) {
diff --git a/ext/zend_test/tests/observer_bug81430_1.phpt b/ext/zend_test/tests/observer_bug81430_1.phpt
index aedfc09ed24..5754fa00f51 100644
--- a/ext/zend_test/tests/observer_bug81430_1.phpt
+++ b/ext/zend_test/tests/observer_bug81430_1.phpt
@@ -38,4 +38,4 @@ function B() {}
     <A::__construct>
     </A::__construct>
   </ReflectionAttribute::newInstance>
-</file '%s'>
\ No newline at end of file
+</file '%s'>
diff --git a/ext/zend_test/tests/observer_error_04.phpt b/ext/zend_test/tests/observer_error_04.phpt
index 2a45bfe78c4..dc195560657 100644
--- a/ext/zend_test/tests/observer_error_04.phpt
+++ b/ext/zend_test/tests/observer_error_04.phpt
@@ -25,7 +25,7 @@ function main()
 try {
     main();
 } catch (SoapFault $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 echo 'Done.' . PHP_EOL;
@@ -45,7 +45,7 @@ function main()
     </foo:NULL>
     <!-- Exception: SoapFault -->
   </main:NULL>
-  <!-- init Exception::getMessage() -->
+SoapFault:   <!-- init Exception::getMessage() -->
   <Exception::getMessage>
   </Exception::getMessage:'SOAP-ERROR: Parsing WSDL: %s
 '>
diff --git a/ext/zend_test/tests/observer_preload.phpt b/ext/zend_test/tests/observer_preload.phpt
index 042c9e088e5..731cc2efa79 100644
--- a/ext/zend_test/tests/observer_preload.phpt
+++ b/ext/zend_test/tests/observer_preload.phpt
@@ -43,4 +43,4 @@
   <foo>
   </foo:'I should be observable'>
 Done
-</file '%sobserver_preload.php'>
\ No newline at end of file
+</file '%sobserver_preload.php'>
diff --git a/ext/zend_test/tests/zend_forbid_dynamic_call.phpt b/ext/zend_test/tests/zend_forbid_dynamic_call.phpt
index 77d8649f532..0e8a8d17009 100644
--- a/ext/zend_test/tests/zend_forbid_dynamic_call.phpt
+++ b/ext/zend_test/tests/zend_forbid_dynamic_call.phpt
@@ -13,17 +13,17 @@
     $call = [$object, 'call'];
     $call();
 } catch (Error $error) {
-    echo $error->getMessage(), "\n";
+    echo $error::class, ': ', $error->getMessage(), "\n";
 }

 try {
     $callStatic = [ZendTestForbidDynamicCall::class, 'callStatic'];
     $callStatic();
 } catch (Error $error) {
-    echo $error->getMessage(), "\n";
+    echo $error::class, ': ', $error->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Cannot call ZendTestForbidDynamicCall::call() dynamically
-Cannot call ZendTestForbidDynamicCall::callStatic() dynamically
+Error: Cannot call ZendTestForbidDynamicCall::call() dynamically
+Error: Cannot call ZendTestForbidDynamicCall::callStatic() dynamically
diff --git a/ext/zend_test/tests/zend_internal_class_prop_intersection.phpt b/ext/zend_test/tests/zend_internal_class_prop_intersection.phpt
index dd9fe93a130..f7f421f27d8 100644
--- a/ext/zend_test/tests/zend_internal_class_prop_intersection.phpt
+++ b/ext/zend_test/tests/zend_internal_class_prop_intersection.phpt
@@ -28,12 +28,12 @@ public function count(): int {
 try {
     $o->classIntersectionProp = new EmptyIterator();
 } catch (TypeError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     $o->classIntersectionProp = new C();
 } catch (TypeError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 $o->classIntersectionProp = new I();

@@ -41,6 +41,6 @@ public function count(): int {
 ==DONE==
 --EXPECT--
 Error: Typed property _ZendTestClass::$classIntersectionProp must not be accessed before initialization
-Cannot assign EmptyIterator to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable
-Cannot assign C to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable
+TypeError: Cannot assign EmptyIterator to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable
+TypeError: Cannot assign C to property _ZendTestClass::$classIntersectionProp of type Traversable&Countable
 ==DONE==
diff --git a/ext/zend_test/tests/zend_test_compile_string.phpt b/ext/zend_test/tests/zend_test_compile_string.phpt
index fb47f748f87..543c086bdb7 100644
--- a/ext/zend_test/tests/zend_test_compile_string.phpt
+++ b/ext/zend_test/tests/zend_test_compile_string.phpt
@@ -46,7 +46,7 @@
 try {
 	zend_test_compile_string($source_string, "Sources\0string", ZEND_COMPILE_POSITION_AT_OPEN_TAG);
 } catch (\ValueError $e) {
-	echo $e->getMessage(), PHP_EOL;
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 zend_test_compile_string(null, null, null);
@@ -65,7 +65,7 @@
 string(3) "php"
 string(3) "php"
 string(3) "php"
-zend_test_compile_string(): Argument #2 ($filename) must not contain any null bytes
+ValueError: zend_test_compile_string(): Argument #2 ($filename) must not contain any null bytes

 Deprecated: zend_test_compile_string(): Passing null to parameter #1 ($source_string) of type string is deprecated in %s on line %d

diff --git a/ext/zlib/tests/deflate_add_error.phpt b/ext/zlib/tests/deflate_add_error.phpt
index af7b95b7901..b4fc42aaf31 100644
--- a/ext/zlib/tests/deflate_add_error.phpt
+++ b/ext/zlib/tests/deflate_add_error.phpt
@@ -9,7 +9,7 @@
 try {
     var_dump(deflate_add($badResource, "test"));
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 $resource = deflate_init(ZLIB_ENCODING_DEFLATE);
@@ -18,10 +18,10 @@
 try {
     var_dump(deflate_add($resource, "test", $badFlushType));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-deflate_add(): Argument #1 ($context) must be of type DeflateContext, resource given
-deflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH
+TypeError: deflate_add(): Argument #1 ($context) must be of type DeflateContext, resource given
+ValueError: deflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH
diff --git a/ext/zlib/tests/deflate_init_error.phpt b/ext/zlib/tests/deflate_init_error.phpt
index 6752b650e24..9fe0323a7d2 100644
--- a/ext/zlib/tests/deflate_init_error.phpt
+++ b/ext/zlib/tests/deflate_init_error.phpt
@@ -8,37 +8,37 @@
 try {
     var_dump(deflate_init(42));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => 42]));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => -2]));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 0]));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 10]));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
-deflate_init(): "level" option must be between -1 and 9
-deflate_init(): "level" option must be between -1 and 9
-deflate_init(): "memory" option must be between 1 and 9
-deflate_init(): "memory" option must be between 1 and 9
+ValueError: deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
+ValueError: deflate_init(): "level" option must be between -1 and 9
+ValueError: deflate_init(): "level" option must be between -1 and 9
+ValueError: deflate_init(): "memory" option must be between 1 and 9
+ValueError: deflate_init(): "memory" option must be between 1 and 9
diff --git a/ext/zlib/tests/deflate_init_strategy_type_error.phpt b/ext/zlib/tests/deflate_init_strategy_type_error.phpt
index 2a59082bc32..7b2e9184529 100644
--- a/ext/zlib/tests/deflate_init_strategy_type_error.phpt
+++ b/ext/zlib/tests/deflate_init_strategy_type_error.phpt
@@ -11,32 +11,32 @@ class A {}
 try {
     deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => 'foo']);
 } catch (TypeError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => []]);
 } catch (TypeError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     deflate_init(ZLIB_ENCODING_DEFLATE, ['window' => new A()]);
 } catch (TypeError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     deflate_init(ZLIB_ENCODING_DEFLATE, ['strategy' => $fp]);
 } catch (TypeError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 fclose($fp);

 ?>
 --EXPECT--
-deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, string given
-deflate_init(): Argument #2 ($options) the value for option "memory" must be of type int, array given
-deflate_init(): Argument #2 ($options) the value for option "window" must be of type int, A given
-deflate_init(): Argument #2 ($options) the value for option "strategy" must be of type int, resource given
+TypeError: deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, string given
+TypeError: deflate_init(): Argument #2 ($options) the value for option "memory" must be of type int, array given
+TypeError: deflate_init(): Argument #2 ($options) the value for option "window" must be of type int, A given
+TypeError: deflate_init(): Argument #2 ($options) the value for option "strategy" must be of type int, resource given
diff --git a/ext/zlib/tests/gh16326.phpt b/ext/zlib/tests/gh16326.phpt
index b4997368549..fe7eb137095 100644
--- a/ext/zlib/tests/gh16326.phpt
+++ b/ext/zlib/tests/gh16326.phpt
@@ -7,20 +7,20 @@
 try {
     deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => [" ", ""]]);
 } catch (ValueError $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try {
     deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => ["hello", "wor\0ld"]]);
 } catch (ValueError $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try {
     deflate_init(ZLIB_ENCODING_DEFLATE, ["dictionary" => [" ", new stdClass]]);
 } catch (Error $ex) {
-    echo $ex->getMessage(), "\n";
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-deflate_init(): Argument #2 ($options) must not contain empty strings
-deflate_init(): Argument #2 ($options) must not contain strings with null bytes
-Object of class stdClass could not be converted to string
+ValueError: deflate_init(): Argument #2 ($options) must not contain empty strings
+ValueError: deflate_init(): Argument #2 ($options) must not contain strings with null bytes
+Error: Object of class stdClass could not be converted to string
diff --git a/ext/zlib/tests/gh22142.phpt b/ext/zlib/tests/gh22142.phpt
index 84397a4e85a..9bbb9332df3 100644
--- a/ext/zlib/tests/gh22142.phpt
+++ b/ext/zlib/tests/gh22142.phpt
@@ -12,9 +12,9 @@ class Options {
 try {
     deflate_init(ZLIB_ENCODING_DEFLATE, new Options());
 } catch (TypeError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, null given
+TypeError: deflate_init(): Argument #2 ($options) the value for option "level" must be of type int, null given
diff --git a/ext/zlib/tests/gzclose_basic.phpt b/ext/zlib/tests/gzclose_basic.phpt
index f2e03a579de..28a215681c0 100644
--- a/ext/zlib/tests/gzclose_basic.phpt
+++ b/ext/zlib/tests/gzclose_basic.phpt
@@ -16,7 +16,7 @@
 try {
     gzread($h, 20);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 $h = gzopen($f, 'r');
@@ -27,13 +27,13 @@
 try {
     gzread($h, 20);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }


 ?>
 --EXPECT--
 bool(true)
-gzread(): Argument #1 ($stream) must be an open stream resource
+TypeError: gzread(): Argument #1 ($stream) must be an open stream resource
 bool(true)
-gzread(): Argument #1 ($stream) must be an open stream resource
+TypeError: gzread(): Argument #1 ($stream) must be an open stream resource
diff --git a/ext/zlib/tests/gzcompress_error1.phpt b/ext/zlib/tests/gzcompress_error1.phpt
index b2174375541..f21daedd537 100644
--- a/ext/zlib/tests/gzcompress_error1.phpt
+++ b/ext/zlib/tests/gzcompress_error1.phpt
@@ -16,7 +16,7 @@
 try {
     var_dump(gzcompress($data, $bad_level));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 echo "\n-- Testing with invalid encoding --\n";
@@ -25,7 +25,7 @@
 try {
     var_dump(gzcompress($data, $level, $encoding));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
@@ -33,7 +33,7 @@
 *** Testing gzcompress() : error conditions ***

 -- Testing with incorrect compression level --
-gzcompress(): Argument #2 ($level) must be between -1 and 9
+ValueError: gzcompress(): Argument #2 ($level) must be between -1 and 9

 -- Testing with invalid encoding --
-gzcompress(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
+ValueError: gzcompress(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
diff --git a/ext/zlib/tests/gzdeflate_error1.phpt b/ext/zlib/tests/gzdeflate_error1.phpt
index 9b065edfc24..75959f85cb0 100644
--- a/ext/zlib/tests/gzdeflate_error1.phpt
+++ b/ext/zlib/tests/gzdeflate_error1.phpt
@@ -17,7 +17,7 @@
 try {
     var_dump(gzdeflate($data, $bad_level));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 echo "\n-- Testing with incorrect encoding --\n";
@@ -26,7 +26,7 @@
 try {
     var_dump(gzdeflate($data, $level, $bad_encoding));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
@@ -34,7 +34,7 @@
 *** Testing gzdeflate() : error conditions ***

 -- Testing with incorrect compression level --
-gzdeflate(): Argument #2 ($level) must be between -1 and 9
+ValueError: gzdeflate(): Argument #2 ($level) must be between -1 and 9

 -- Testing with incorrect encoding --
-gzdeflate(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
+ValueError: gzdeflate(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
diff --git a/ext/zlib/tests/gzencode_error1.phpt b/ext/zlib/tests/gzencode_error1.phpt
index 8428d3b950d..c15d47f5b1f 100644
--- a/ext/zlib/tests/gzencode_error1.phpt
+++ b/ext/zlib/tests/gzencode_error1.phpt
@@ -19,7 +19,7 @@
 try {
     var_dump(gzencode($data, $bad_level));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 echo "\n-- Testing with incorrect encoding_mode --\n";
@@ -27,7 +27,7 @@
 try {
     var_dump(gzencode($data, $level, $bad_mode));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
@@ -35,7 +35,7 @@
 *** Testing gzencode() : error conditions ***

 -- Testing with incorrect compression level --
-gzencode(): Argument #2 ($level) must be between -1 and 9
+ValueError: gzencode(): Argument #2 ($level) must be between -1 and 9

 -- Testing with incorrect encoding_mode --
-gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
+ValueError: gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
diff --git a/ext/zlib/tests/gzencode_invalid.phpt b/ext/zlib/tests/gzencode_invalid.phpt
index e64bb294b3e..98df53825fe 100644
--- a/ext/zlib/tests/gzencode_invalid.phpt
+++ b/ext/zlib/tests/gzencode_invalid.phpt
@@ -8,17 +8,17 @@
 try {
     var_dump(gzencode("", -10));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     var_dump(gzencode("", 100));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 try {
     var_dump(gzencode("", 1, 100));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 var_dump(gzencode("", -1, ZLIB_ENCODING_GZIP));
@@ -32,7 +32,7 @@
 try {
     var_dump(gzencode($string, 9, 3));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 var_dump(gzencode($string, -1, ZLIB_ENCODING_GZIP));
@@ -40,11 +40,11 @@

 ?>
 --EXPECTF--
-gzencode(): Argument #2 ($level) must be between -1 and 9
-gzencode(): Argument #2 ($level) must be between -1 and 9
-gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
+ValueError: gzencode(): Argument #2 ($level) must be between -1 and 9
+ValueError: gzencode(): Argument #2 ($level) must be between -1 and 9
+ValueError: gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
 string(%d) "%a"
 string(%d) "%a"
-gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
+ValueError: gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
 string(%d) "%a"
 string(%d) "%a"
diff --git a/ext/zlib/tests/gzeof_variation1.phpt b/ext/zlib/tests/gzeof_variation1.phpt
index fb4191fa794..55bfc55cab4 100644
--- a/ext/zlib/tests/gzeof_variation1.phpt
+++ b/ext/zlib/tests/gzeof_variation1.phpt
@@ -17,11 +17,11 @@
 try {
     var_dump(gzeof($h));
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 unlink($filename);
 ?>
 --EXPECT--
 bool(false)
 bool(false)
-gzeof(): Argument #1 ($stream) must be an open stream resource
+TypeError: gzeof(): Argument #1 ($stream) must be an open stream resource
diff --git a/ext/zlib/tests/gzfile_variation15.phpt b/ext/zlib/tests/gzfile_variation15.phpt
index f33abba0284..922718ce018 100644
--- a/ext/zlib/tests/gzfile_variation15.phpt
+++ b/ext/zlib/tests/gzfile_variation15.phpt
@@ -99,4 +99,3 @@ function test_gzfile() {
   [0]=>
   string(28) "This is a file in script dir"
 }
-
diff --git a/ext/zlib/tests/gzopen_variation9.phpt b/ext/zlib/tests/gzopen_variation9.phpt
index 0118dd3ea13..78f512f9d92 100644
--- a/ext/zlib/tests/gzopen_variation9.phpt
+++ b/ext/zlib/tests/gzopen_variation9.phpt
@@ -40,4 +40,3 @@

 Warning: gzopen(): Failed to open stream: %s in %s on line %d
 gzopen=bool(false)
-
diff --git a/ext/zlib/tests/gzread_error2.phpt b/ext/zlib/tests/gzread_error2.phpt
index 0a3d08efd09..ab7231f64c9 100644
--- a/ext/zlib/tests/gzread_error2.phpt
+++ b/ext/zlib/tests/gzread_error2.phpt
@@ -10,13 +10,13 @@
 try {
     var_dump(gzread($h, 0));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 var_dump(gzread($h, 5));
 try {
     var_dump(gzread($h, -1));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 var_dump(gzread($h, 8));
 gzclose($h);
@@ -24,7 +24,7 @@
 ?>
 --EXPECT--
 string(10) "When you'r"
-gzread(): Argument #2 ($length) must be greater than 0
+ValueError: gzread(): Argument #2 ($length) must be greater than 0
 string(5) "e tau"
-gzread(): Argument #2 ($length) must be greater than 0
+ValueError: gzread(): Argument #2 ($length) must be greater than 0
 string(8) "ght thro"
diff --git a/ext/zlib/tests/gzwrite_error2.phpt b/ext/zlib/tests/gzwrite_error2.phpt
index 5201f8064ae..1e71e4b5548 100644
--- a/ext/zlib/tests/gzwrite_error2.phpt
+++ b/ext/zlib/tests/gzwrite_error2.phpt
@@ -21,4 +21,3 @@
 --EXPECT--
 int(0)
 int(0)
-
diff --git a/ext/zlib/tests/inflate_add_error.phpt b/ext/zlib/tests/inflate_add_error.phpt
index 129fd5b794f..1d805ba5f9d 100644
--- a/ext/zlib/tests/inflate_add_error.phpt
+++ b/ext/zlib/tests/inflate_add_error.phpt
@@ -9,7 +9,7 @@
 try {
     var_dump(inflate_add($badResource, "test"));
 } catch (\TypeError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 $resource = inflate_init(ZLIB_ENCODING_DEFLATE);
@@ -17,10 +17,10 @@
 try {
     var_dump(inflate_add($resource, "test", $badFlushType));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-inflate_add(): Argument #1 ($context) must be of type InflateContext, resource given
-inflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH
+TypeError: inflate_add(): Argument #1 ($context) must be of type InflateContext, resource given
+ValueError: inflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH
diff --git a/ext/zlib/tests/inflate_init_error.phpt b/ext/zlib/tests/inflate_init_error.phpt
index 9854f745390..a5b6f6ca989 100644
--- a/ext/zlib/tests/inflate_init_error.phpt
+++ b/ext/zlib/tests/inflate_init_error.phpt
@@ -8,9 +8,9 @@
 try {
     var_dump(inflate_init(42));
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-inflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
+ValueError: inflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
diff --git a/ext/zlib/tests/inflate_init_window_type_error.phpt b/ext/zlib/tests/inflate_init_window_type_error.phpt
index fbca3129681..cd4c178f2a2 100644
--- a/ext/zlib/tests/inflate_init_window_type_error.phpt
+++ b/ext/zlib/tests/inflate_init_window_type_error.phpt
@@ -8,9 +8,9 @@
 try {
     inflate_init(ZLIB_ENCODING_DEFLATE, ['window' => []]);
 } catch (TypeError $e) {
-    echo $e->getMessage(), PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-inflate_init(): Argument #2 ($options) the value for option "window" must be of type int, array given
+TypeError: inflate_init(): Argument #2 ($options) the value for option "window" must be of type int, array given
diff --git a/ext/zlib/tests/leak_invalid_encoding_with_dict.phpt b/ext/zlib/tests/leak_invalid_encoding_with_dict.phpt
index 507e6842cb5..a33aa058faa 100644
--- a/ext/zlib/tests/leak_invalid_encoding_with_dict.phpt
+++ b/ext/zlib/tests/leak_invalid_encoding_with_dict.phpt
@@ -7,14 +7,14 @@
 try {
 	inflate_init(123456, ["dictionary" => "dict"]);
 } catch (ValueError $e) {
-	echo $e->getMessage(), "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
 	deflate_init(123456, ["dictionary" => "dict"]);
 } catch (ValueError $e) {
-	echo $e->getMessage(), "\n";
+	echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-inflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
-deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
+ValueError: inflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
+ValueError: deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE