[PHP-CVS] [php-src] master: ext/bcmath: applied fixers to improve test robustness (#23129)

[email protected] (NickSdot via GitHub)
Newsgroups php.cvs
Message-ID <[email protected]>
Author: NickSdot (NickSdot)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-08-22T14:08:15+01:00

Commit: https://github.com/php/php-src/commit/7ca205842e164cb12253c760489e5348cf54e397
Raw diff: https://github.com/php/php-src/commit/7ca205842e164cb12253c760489e5348cf54e397.diff

ext/bcmath: applied fixers to improve test robustness (#23129)

Changed paths:
  M  ext/bcmath/tests/bcadd_error.phpt
  M  ext/bcmath/tests/bcceil_error.phpt
  M  ext/bcmath/tests/bccomp_error.phpt
  M  ext/bcmath/tests/bcdiv_error1.phpt
  M  ext/bcmath/tests/bcdiv_error2.phpt
  M  ext/bcmath/tests/bcfloor_error.phpt
  M  ext/bcmath/tests/bcmod_error2.phpt
  M  ext/bcmath/tests/bcmod_error3.phpt
  M  ext/bcmath/tests/bcmul_error.phpt
  M  ext/bcmath/tests/bcpow_div_by_zero.phpt
  M  ext/bcmath/tests/bcpow_error1.phpt
  M  ext/bcmath/tests/bcpow_error2.phpt
  M  ext/bcmath/tests/bcpow_error3.phpt
  M  ext/bcmath/tests/bcpowmod_error.phpt
  M  ext/bcmath/tests/bcpowmod_negative_exponent.phpt
  M  ext/bcmath/tests/bcpowmod_zero_modulus.phpt
  M  ext/bcmath/tests/bcround_error.phpt
  M  ext/bcmath/tests/bcround_precision_bounds.phpt
  M  ext/bcmath/tests/bcscale_variation001.phpt
  M  ext/bcmath/tests/bcsqrt_error1.phpt
  M  ext/bcmath/tests/bcsqrt_error2.phpt
  M  ext/bcmath/tests/bcsub_error.phpt
  M  ext/bcmath/tests/bug60377.phpt
  M  ext/bcmath/tests/bug72093.phpt
  M  ext/bcmath/tests/bug75178.phpt
  M  ext/bcmath/tests/bug78878.phpt
  M  ext/bcmath/tests/bug80545.phpt
  M  ext/bcmath/tests/gh15968.phpt
  M  ext/bcmath/tests/negative_scale.phpt
  M  ext/bcmath/tests/number/construct_error.phpt
  M  ext/bcmath/tests/number/methods/calc_methods_num_arg_error.phpt
  M  ext/bcmath/tests/number/methods/calc_methods_scale_arg_error.phpt
  M  ext/bcmath/tests/number/methods/compare_arg_error.phpt
  M  ext/bcmath/tests/number/methods/pow_div_by_zero.phpt
  M  ext/bcmath/tests/number/methods/powmod_arg_error.phpt
  M  ext/bcmath/tests/number/operators/calc_array.phpt
  M  ext/bcmath/tests/number/operators/calc_non_numeric_string.phpt
  M  ext/bcmath/tests/number/operators/calc_null.phpt
  M  ext/bcmath/tests/number/operators/calc_other_class.phpt
  M  ext/bcmath/tests/number/operators/calc_undef.phpt
  M  ext/bcmath/tests/number/operators/div_by_zero.phpt
  M  ext/bcmath/tests/number/operators/mod_by_zero.phpt
  M  ext/bcmath/tests/number/operators/pow_div_by_zero.phpt
  M  ext/bcmath/tests/number/properties_unknown.phpt
  M  ext/bcmath/tests/number/properties_unset.phpt
  M  ext/bcmath/tests/number/properties_write_error.phpt
  M  ext/bcmath/tests/number/unserialize_error.phpt
  M  ext/bcmath/tests/sec_embedded_null_truncation.phpt
  M  ext/bcmath/tests/str2num_formatting.phpt


Diff:

diff --git a/ext/bcmath/tests/bcadd_error.phpt b/ext/bcmath/tests/bcadd_error.phpt
index 320bf390680a..77cb46c18c1f 100644
--- a/ext/bcmath/tests/bcadd_error.phpt
+++ b/ext/bcmath/tests/bcadd_error.phpt
@@ -7,17 +7,17 @@ bcmath
 
 try {
     bcadd('a', '1');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcadd('1', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bcadd(): Argument #1 ($num1) is not well-formed
-bcadd(): Argument #2 ($num2) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcadd(): Argument #2 ($num2) is not well-formed
diff --git a/ext/bcmath/tests/bcceil_error.phpt b/ext/bcmath/tests/bcceil_error.phpt
index fd4c51ff6c58..58df0fdce601 100644
--- a/ext/bcmath/tests/bcceil_error.phpt
+++ b/ext/bcmath/tests/bcceil_error.phpt
@@ -7,15 +7,15 @@ bcmath
 try {
     bcceil('hoge');
 } catch (Throwable $e) {
-    echo $e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcceil('0.00.1');
 } catch (Throwable $e) {
-    echo $e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcceil(): Argument #1 ($num) is not well-formed
-bcceil(): Argument #1 ($num) is not well-formed
+ValueError: bcceil(): Argument #1 ($num) is not well-formed
+ValueError: bcceil(): Argument #1 ($num) is not well-formed
diff --git a/ext/bcmath/tests/bccomp_error.phpt b/ext/bcmath/tests/bccomp_error.phpt
index 90645c52f7e5..5cc2c2f4ca03 100644
--- a/ext/bcmath/tests/bccomp_error.phpt
+++ b/ext/bcmath/tests/bccomp_error.phpt
@@ -7,17 +7,17 @@ bcmath
 
 try {
     bccomp('a', '1');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bccomp('1', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bccomp(): Argument #1 ($num1) is not well-formed
-bccomp(): Argument #2 ($num2) is not well-formed
+ValueError: bccomp(): Argument #1 ($num1) is not well-formed
+ValueError: bccomp(): Argument #2 ($num2) is not well-formed
diff --git a/ext/bcmath/tests/bcdiv_error1.phpt b/ext/bcmath/tests/bcdiv_error1.phpt
index b6af64d69af3..154f20e52d82 100644
--- a/ext/bcmath/tests/bcdiv_error1.phpt
+++ b/ext/bcmath/tests/bcdiv_error1.phpt
@@ -10,23 +10,23 @@ bcmath
 <?php
 try {
     bcdiv('10.99', '0');
-} catch (DivisionByZeroError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+} catch (Throwable $ex) {
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 
 try {
     bcdiv('10.99', '0.00');
-} catch (DivisionByZeroError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+} catch (Throwable $ex) {
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 
 try {
     bcdiv('10.99', '-0.00');
-} catch (DivisionByZeroError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+} catch (Throwable $ex) {
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Division by zero
-Division by zero
-Division by zero
+DivisionByZeroError: Division by zero
+DivisionByZeroError: Division by zero
+DivisionByZeroError: Division by zero
diff --git a/ext/bcmath/tests/bcdiv_error2.phpt b/ext/bcmath/tests/bcdiv_error2.phpt
index a4e1cae35354..622760327c5d 100644
--- a/ext/bcmath/tests/bcdiv_error2.phpt
+++ b/ext/bcmath/tests/bcdiv_error2.phpt
@@ -7,17 +7,17 @@ bcmath
 
 try {
     bcdiv('a', '1');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcdiv('1', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bcdiv(): Argument #1 ($num1) is not well-formed
-bcdiv(): Argument #2 ($num2) is not well-formed
+ValueError: bcdiv(): Argument #1 ($num1) is not well-formed
+ValueError: bcdiv(): Argument #2 ($num2) is not well-formed
diff --git a/ext/bcmath/tests/bcfloor_error.phpt b/ext/bcmath/tests/bcfloor_error.phpt
index 7578a5afe3b8..28556b366aaa 100644
--- a/ext/bcmath/tests/bcfloor_error.phpt
+++ b/ext/bcmath/tests/bcfloor_error.phpt
@@ -7,15 +7,15 @@ bcmath
 try {
     bcfloor('hoge');
 } catch (Throwable $e) {
-    echo $e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcfloor('0.00.1');
 } catch (Throwable $e) {
-    echo $e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcfloor(): Argument #1 ($num) is not well-formed
-bcfloor(): Argument #1 ($num) is not well-formed
+ValueError: bcfloor(): Argument #1 ($num) is not well-formed
+ValueError: bcfloor(): Argument #1 ($num) is not well-formed
diff --git a/ext/bcmath/tests/bcmod_error2.phpt b/ext/bcmath/tests/bcmod_error2.phpt
index 37c433fbb89c..f3cb6074cb26 100644
--- a/ext/bcmath/tests/bcmod_error2.phpt
+++ b/ext/bcmath/tests/bcmod_error2.phpt
@@ -8,21 +8,21 @@ bcmath.scale=0
 <?php
 try {
     bcmod("10", "0");
-} catch (DivisionByZeroError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+} catch (Throwable $ex) {
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try {
     bcmod("10", "0.000");
-} catch (DivisionByZeroError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+} catch (Throwable $ex) {
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 try {
     bcmod("10", "-0.0");
-} catch (DivisionByZeroError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+} catch (Throwable $ex) {
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Modulo by zero
-Modulo by zero
-Modulo by zero
+DivisionByZeroError: Modulo by zero
+DivisionByZeroError: Modulo by zero
+DivisionByZeroError: Modulo by zero
diff --git a/ext/bcmath/tests/bcmod_error3.phpt b/ext/bcmath/tests/bcmod_error3.phpt
index 8df986fe7654..ee8768f90e79 100644
--- a/ext/bcmath/tests/bcmod_error3.phpt
+++ b/ext/bcmath/tests/bcmod_error3.phpt
@@ -7,17 +7,17 @@ bcmath
 
 try {
     bcmod('a', '1');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcmod('1', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bcmod(): Argument #1 ($num1) is not well-formed
-bcmod(): Argument #2 ($num2) is not well-formed
+ValueError: bcmod(): Argument #1 ($num1) is not well-formed
+ValueError: bcmod(): Argument #2 ($num2) is not well-formed
diff --git a/ext/bcmath/tests/bcmul_error.phpt b/ext/bcmath/tests/bcmul_error.phpt
index 361b46163ee6..b1a6364c6a65 100644
--- a/ext/bcmath/tests/bcmul_error.phpt
+++ b/ext/bcmath/tests/bcmul_error.phpt
@@ -7,17 +7,17 @@ bcmath
 
 try {
     bcmul('a', '1');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcmul('1', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bcmul(): Argument #1 ($num1) is not well-formed
-bcmul(): Argument #2 ($num2) is not well-formed
+ValueError: bcmul(): Argument #1 ($num1) is not well-formed
+ValueError: bcmul(): Argument #2 ($num2) is not well-formed
diff --git a/ext/bcmath/tests/bcpow_div_by_zero.phpt b/ext/bcmath/tests/bcpow_div_by_zero.phpt
index ac1e8187450c..1d6fb2b7d2f4 100644
--- a/ext/bcmath/tests/bcpow_div_by_zero.phpt
+++ b/ext/bcmath/tests/bcpow_div_by_zero.phpt
@@ -13,17 +13,17 @@ foreach ($baseNumbers as $baseNumber) {
     foreach ($exponents as $exponent) {
         try {
             echo bcpow($baseNumber, $exponent), "\n";
-        } catch (Error $e) {
-            echo $e->getMessage(), "\n";
+        } catch (Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
 }
 
 ?>
 --EXPECT--
-Negative power of zero
-Negative power of zero
-Negative power of zero
-Negative power of zero
-Negative power of zero
-Negative power of zero
+DivisionByZeroError: Negative power of zero
+DivisionByZeroError: Negative power of zero
+DivisionByZeroError: Negative power of zero
+DivisionByZeroError: Negative power of zero
+DivisionByZeroError: Negative power of zero
+DivisionByZeroError: Negative power of zero
diff --git a/ext/bcmath/tests/bcpow_error1.phpt b/ext/bcmath/tests/bcpow_error1.phpt
index fefdfc57a010..0a78b4bdeb51 100644
--- a/ext/bcmath/tests/bcpow_error1.phpt
+++ b/ext/bcmath/tests/bcpow_error1.phpt
@@ -6,15 +6,15 @@ bcmath
 <?php
 try {
     var_dump(bcpow('1', '1.1', 2));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(bcpow('1', '0.1', 2));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcpow(): Argument #2 ($exponent) cannot have a fractional part
-bcpow(): Argument #2 ($exponent) cannot have a fractional part
+ValueError: bcpow(): Argument #2 ($exponent) cannot have a fractional part
+ValueError: bcpow(): Argument #2 ($exponent) cannot have a fractional part
diff --git a/ext/bcmath/tests/bcpow_error2.phpt b/ext/bcmath/tests/bcpow_error2.phpt
index f9b830ca7d5b..a959a37399ee 100644
--- a/ext/bcmath/tests/bcpow_error2.phpt
+++ b/ext/bcmath/tests/bcpow_error2.phpt
@@ -6,16 +6,16 @@ bcmath
 <?php
 try {
     var_dump(bcpow('0', '9223372036854775808', 2));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     var_dump(bcpow('0', '-9223372036854775808', 2));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcpow(): Argument #2 ($exponent) is too large
-bcpow(): Argument #2 ($exponent) is too large
+ValueError: bcpow(): Argument #2 ($exponent) is too large
+ValueError: bcpow(): Argument #2 ($exponent) is too large
diff --git a/ext/bcmath/tests/bcpow_error3.phpt b/ext/bcmath/tests/bcpow_error3.phpt
index f47c85d4da86..1c97cce12b6f 100644
--- a/ext/bcmath/tests/bcpow_error3.phpt
+++ b/ext/bcmath/tests/bcpow_error3.phpt
@@ -7,17 +7,17 @@ bcmath
 
 try {
     bcpow('a', '1');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcpow('1', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bcpow(): Argument #1 ($num) is not well-formed
-bcpow(): Argument #2 ($exponent) is not well-formed
+ValueError: bcpow(): Argument #1 ($num) is not well-formed
+ValueError: bcpow(): Argument #2 ($exponent) is not well-formed
diff --git a/ext/bcmath/tests/bcpowmod_error.phpt b/ext/bcmath/tests/bcpowmod_error.phpt
index ff2862310cb2..99ba973a1df6 100644
--- a/ext/bcmath/tests/bcpowmod_error.phpt
+++ b/ext/bcmath/tests/bcpowmod_error.phpt
@@ -7,24 +7,24 @@ bcmath
 
 try {
     bcpowmod('a', '1', '1');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcpowmod('1', 'a', '1');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcpowmod('1', '1', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bcpowmod(): Argument #1 ($num) is not well-formed
-bcpowmod(): Argument #2 ($exponent) is not well-formed
-bcpowmod(): Argument #3 ($modulus) is not well-formed
+ValueError: bcpowmod(): Argument #1 ($num) is not well-formed
+ValueError: bcpowmod(): Argument #2 ($exponent) is not well-formed
+ValueError: bcpowmod(): Argument #3 ($modulus) is not well-formed
diff --git a/ext/bcmath/tests/bcpowmod_negative_exponent.phpt b/ext/bcmath/tests/bcpowmod_negative_exponent.phpt
index 7814e2bd41d8..6589177046f2 100644
--- a/ext/bcmath/tests/bcpowmod_negative_exponent.phpt
+++ b/ext/bcmath/tests/bcpowmod_negative_exponent.phpt
@@ -8,9 +8,9 @@ bcmath
 <?php
 try {
     var_dump(bcpowmod('1', '-1', '2'));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcpowmod(): Argument #2 ($exponent) must be greater than or equal to 0
+ValueError: bcpowmod(): Argument #2 ($exponent) must be greater than or equal to 0
diff --git a/ext/bcmath/tests/bcpowmod_zero_modulus.phpt b/ext/bcmath/tests/bcpowmod_zero_modulus.phpt
index 8540a0d6df3c..cf757b07757d 100644
--- a/ext/bcmath/tests/bcpowmod_zero_modulus.phpt
+++ b/ext/bcmath/tests/bcpowmod_zero_modulus.phpt
@@ -8,9 +8,9 @@ bcmath
 <?php
 try {
     var_dump(bcpowmod('1', '1', '0'));
-} catch (DivisionByZeroError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+} catch (Throwable $ex) {
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Modulo by zero
+DivisionByZeroError: Modulo by zero
diff --git a/ext/bcmath/tests/bcround_error.phpt b/ext/bcmath/tests/bcround_error.phpt
index 95579a4edf09..fe114cf8bba6 100644
--- a/ext/bcmath/tests/bcround_error.phpt
+++ b/ext/bcmath/tests/bcround_error.phpt
@@ -7,15 +7,15 @@ bcmath
 try {
     bcround('hoge');
 } catch (Throwable $e) {
-    echo $e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcround('0.00.1');
 } catch (Throwable $e) {
-    echo $e->getMessage()."\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcround(): Argument #1 ($num) is not well-formed
-bcround(): Argument #1 ($num) is not well-formed
+ValueError: bcround(): Argument #1 ($num) is not well-formed
+ValueError: bcround(): Argument #1 ($num) is not well-formed
diff --git a/ext/bcmath/tests/bcround_precision_bounds.phpt b/ext/bcmath/tests/bcround_precision_bounds.phpt
index 4c4f910476a7..ad1d6c9fc0f4 100644
--- a/ext/bcmath/tests/bcround_precision_bounds.phpt
+++ b/ext/bcmath/tests/bcround_precision_bounds.phpt
@@ -8,21 +8,21 @@ bcmath
 <?php
 try {
     bcround('1', PHP_INT_MAX);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     (new BcMath\Number('1'))->round(PHP_INT_MAX);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     (new BcMath\Number('1'))->round(2147483648); // INT_MAX + 1
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
-bcround(): Argument #2 ($precision) must be between %i and %d
-BcMath\Number::round(): Argument #1 ($precision) must be between %i and %d
-BcMath\Number::round(): Argument #1 ($precision) must be between %i and %d
+ValueError: bcround(): Argument #2 ($precision) must be between %i and %d
+ValueError: BcMath\Number::round(): Argument #1 ($precision) must be between %i and %d
+ValueError: BcMath\Number::round(): Argument #1 ($precision) must be between %i and %d
diff --git a/ext/bcmath/tests/bcscale_variation001.phpt b/ext/bcmath/tests/bcscale_variation001.phpt
index 8d9d32e064b8..e816c499fedf 100644
--- a/ext/bcmath/tests/bcscale_variation001.phpt
+++ b/ext/bcmath/tests/bcscale_variation001.phpt
@@ -6,13 +6,13 @@ bcmath
 bcmath.scale=0
 --FILE--
 <?php
-echo bcdiv("20.56", "4");
+echo bcdiv("20.56", "4"), "\n";
 try {
     bcscale(-4);
-} catch (\ValueError $e) {
-    echo \PHP_EOL . $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
 5
-bcscale(): Argument #1 ($scale) must be between 0 and 2147483647
+ValueError: bcscale(): Argument #1 ($scale) must be between 0 and 2147483647
diff --git a/ext/bcmath/tests/bcsqrt_error1.phpt b/ext/bcmath/tests/bcsqrt_error1.phpt
index 78923f4a9480..9c8781923b33 100644
--- a/ext/bcmath/tests/bcsqrt_error1.phpt
+++ b/ext/bcmath/tests/bcsqrt_error1.phpt
@@ -9,9 +9,9 @@ bcmath
 <?php
 try {
     bcsqrt('-9');
-} catch (ValueError $ex) {
-    echo $ex->getMessage(), PHP_EOL;
+} catch (Throwable $ex) {
+    echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcsqrt(): Argument #1 ($num) must be greater than or equal to 0
+ValueError: bcsqrt(): Argument #1 ($num) must be greater than or equal to 0
diff --git a/ext/bcmath/tests/bcsqrt_error2.phpt b/ext/bcmath/tests/bcsqrt_error2.phpt
index 1ef934d3bcf1..7e58beca8fcc 100644
--- a/ext/bcmath/tests/bcsqrt_error2.phpt
+++ b/ext/bcmath/tests/bcsqrt_error2.phpt
@@ -7,10 +7,10 @@ bcmath
 
 try {
     bcsqrt('a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bcsqrt(): Argument #1 ($num) is not well-formed
+ValueError: bcsqrt(): Argument #1 ($num) is not well-formed
diff --git a/ext/bcmath/tests/bcsub_error.phpt b/ext/bcmath/tests/bcsub_error.phpt
index 4e1abd3fa950..029423326414 100644
--- a/ext/bcmath/tests/bcsub_error.phpt
+++ b/ext/bcmath/tests/bcsub_error.phpt
@@ -7,17 +7,17 @@ bcmath
 
 try {
     bcsub('a', '1');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcsub('1', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bcsub(): Argument #1 ($num1) is not well-formed
-bcsub(): Argument #2 ($num2) is not well-formed
+ValueError: bcsub(): Argument #1 ($num1) is not well-formed
+ValueError: bcsub(): Argument #2 ($num2) is not well-formed
diff --git a/ext/bcmath/tests/bug60377.phpt b/ext/bcmath/tests/bug60377.phpt
index 16d058441a35..ed65e83838d5 100644
--- a/ext/bcmath/tests/bug60377.phpt
+++ b/ext/bcmath/tests/bug60377.phpt
@@ -9,11 +9,11 @@ if (PHP_INT_SIZE != 8) die("skip: 64-bit only"); ?>
 <?php
 try {
     $var48 = bcscale(634314234334311);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 $var67 = bcsqrt(0);
 $var414 = bcadd(0,-1,10);
 ?>
 --EXPECT--
-bcscale(): Argument #1 ($scale) must be between 0 and 2147483647
+ValueError: bcscale(): Argument #1 ($scale) must be between 0 and 2147483647
diff --git a/ext/bcmath/tests/bug72093.phpt b/ext/bcmath/tests/bug72093.phpt
index a424a59e0470..68955985e7e9 100644
--- a/ext/bcmath/tests/bug72093.phpt
+++ b/ext/bcmath/tests/bug72093.phpt
@@ -6,15 +6,15 @@ bcmath
 <?php
 try {
     var_dump(bcpowmod(1, 0, 128, -200));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(bcpowmod(1, 1.2, 1, 1));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647
-bcpowmod(): Argument #2 ($exponent) cannot have a fractional part
+ValueError: bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647
+ValueError: bcpowmod(): Argument #2 ($exponent) cannot have a fractional part
diff --git a/ext/bcmath/tests/bug75178.phpt b/ext/bcmath/tests/bug75178.phpt
index 940a3567de16..b39c53dfd5df 100644
--- a/ext/bcmath/tests/bug75178.phpt
+++ b/ext/bcmath/tests/bug75178.phpt
@@ -6,15 +6,15 @@ bcmath
 <?php
 try {
     var_dump(bcpowmod('4.1', '4', '3', 3));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     var_dump(bcpowmod('4', '4', '3.1', 3));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcpowmod(): Argument #1 ($num) cannot have a fractional part
-bcpowmod(): Argument #3 ($modulus) cannot have a fractional part
+ValueError: bcpowmod(): Argument #1 ($num) cannot have a fractional part
+ValueError: bcpowmod(): Argument #3 ($modulus) cannot have a fractional part
diff --git a/ext/bcmath/tests/bug78878.phpt b/ext/bcmath/tests/bug78878.phpt
index 9d9d0db48cf4..7ecd7c151e5e 100644
--- a/ext/bcmath/tests/bug78878.phpt
+++ b/ext/bcmath/tests/bug78878.phpt
@@ -6,9 +6,9 @@ bcmath
 <?php
 try {
     print bcmul("\xB26483605105519922841849335928742092", bcpowmod(2, 65535, -4e-4));
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcpowmod(): Argument #3 ($modulus) cannot have a fractional part
+ValueError: bcpowmod(): Argument #3 ($modulus) cannot have a fractional part
diff --git a/ext/bcmath/tests/bug80545.phpt b/ext/bcmath/tests/bug80545.phpt
index f1e256776d93..7b76a883adda 100644
--- a/ext/bcmath/tests/bug80545.phpt
+++ b/ext/bcmath/tests/bug80545.phpt
@@ -7,17 +7,17 @@ bcmath
 
 try {
     bcadd('a', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     bcadd('1', 'a');
-} catch (\ValueError $e) {
-    echo $e->getMessage();
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-bcadd(): Argument #1 ($num1) is not well-formed
-bcadd(): Argument #2 ($num2) is not well-formed
\ No newline at end of file
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcadd(): Argument #2 ($num2) is not well-formed
diff --git a/ext/bcmath/tests/gh15968.phpt b/ext/bcmath/tests/gh15968.phpt
index aa91534e7738..4b12b0e6cc41 100644
--- a/ext/bcmath/tests/gh15968.phpt
+++ b/ext/bcmath/tests/gh15968.phpt
@@ -14,9 +14,9 @@ $a = new BCMath\Number("1");
 $b = new MyString();
 try {
     var_dump($a + $b);
-} catch (Error $e) {
-    echo $e->getMessage();
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Unsupported operand types: BcMath\Number + MyString
+TypeError: Unsupported operand types: BcMath\Number + MyString
diff --git a/ext/bcmath/tests/negative_scale.phpt b/ext/bcmath/tests/negative_scale.phpt
index 3b9377559098..0b10fbfc1c3f 100644
--- a/ext/bcmath/tests/negative_scale.phpt
+++ b/ext/bcmath/tests/negative_scale.phpt
@@ -8,63 +8,63 @@ bcmath.scale=0
 <?php
 try {
     bcadd('1','2',-1);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bcsub('1','2',-1);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bcmul('1','2',-1);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bcdiv('1','2',-1);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bcmod('1','2',-1);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bcpowmod('1', '2', '3', -9);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bcpow('1', '2', -1);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bcsqrt('9', -1);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bccomp('1', '2', -1);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 try {
     bcscale(-1);
-} catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-bcadd(): Argument #3 ($scale) must be between 0 and 2147483647
-bcsub(): Argument #3 ($scale) must be between 0 and 2147483647
-bcmul(): Argument #3 ($scale) must be between 0 and 2147483647
-bcdiv(): Argument #3 ($scale) must be between 0 and 2147483647
-bcmod(): Argument #3 ($scale) must be between 0 and 2147483647
-bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647
-bcpow(): Argument #3 ($scale) must be between 0 and 2147483647
-bcsqrt(): Argument #2 ($scale) must be between 0 and 2147483647
-bccomp(): Argument #3 ($scale) must be between 0 and 2147483647
-bcscale(): Argument #1 ($scale) must be between 0 and 2147483647
+ValueError: bcadd(): Argument #3 ($scale) must be between 0 and 2147483647
+ValueError: bcsub(): Argument #3 ($scale) must be between 0 and 2147483647
+ValueError: bcmul(): Argument #3 ($scale) must be between 0 and 2147483647
+ValueError: bcdiv(): Argument #3 ($scale) must be between 0 and 2147483647
+ValueError: bcmod(): Argument #3 ($scale) must be between 0 and 2147483647
+ValueError: bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647
+ValueError: bcpow(): Argument #3 ($scale) must be between 0 and 2147483647
+ValueError: bcsqrt(): Argument #2 ($scale) must be between 0 and 2147483647
+ValueError: bccomp(): Argument #3 ($scale) must be between 0 and 2147483647
+ValueError: bcscale(): Argument #1 ($scale) must be between 0 and 2147483647
diff --git a/ext/bcmath/tests/number/construct_error.phpt b/ext/bcmath/tests/number/construct_error.phpt
index 0b49e871cea9..0a05a0b57110 100644
--- a/ext/bcmath/tests/number/construct_error.phpt
+++ b/ext/bcmath/tests/number/construct_error.phpt
@@ -7,17 +7,17 @@ bcmath
 try {
     $num = new BcMath\Number('1');
     $num->__construct(5);
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num = new BcMath\Number('a');
     var_dump($num);
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Cannot modify readonly property BcMath\Number::$value
-BcMath\Number::__construct(): Argument #1 ($num) is not well-formed
+Error: Cannot modify readonly property BcMath\Number::$value
+ValueError: BcMath\Number::__construct(): Argument #1 ($num) is not well-formed
diff --git a/ext/bcmath/tests/number/methods/calc_methods_num_arg_error.phpt b/ext/bcmath/tests/number/methods/calc_methods_num_arg_error.phpt
index 7f64f3101139..256d73f16c3a 100644
--- a/ext/bcmath/tests/number/methods/calc_methods_num_arg_error.phpt
+++ b/ext/bcmath/tests/number/methods/calc_methods_num_arg_error.phpt
@@ -28,8 +28,8 @@ foreach ($methods as $method) {
         echo "{$type}:\n";
         try {
             $num->$method($val);
-        } catch (Error $e) {
-            echo $e->getMessage() . "\n";
+        } catch (Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
     echo "\n";
@@ -38,11 +38,11 @@ foreach ($methods as $method) {
 --EXPECTF--
 ========== add ==========
 non number str:
-BcMath\Number::add(): Argument #1 ($num) is not well-formed
+ValueError: BcMath\Number::add(): Argument #1 ($num) is not well-formed
 array:
-BcMath\Number::add(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
+TypeError: BcMath\Number::add(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
 other object:
-BcMath\Number::add(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
+TypeError: BcMath\Number::add(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
@@ -52,11 +52,11 @@ Deprecated: BcMath\Number::add(): Passing null to parameter #1 ($num) of type Bc
 
 ========== sub ==========
 non number str:
-BcMath\Number::sub(): Argument #1 ($num) is not well-formed
+ValueError: BcMath\Number::sub(): Argument #1 ($num) is not well-formed
 array:
-BcMath\Number::sub(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
+TypeError: BcMath\Number::sub(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
 other object:
-BcMath\Number::sub(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
+TypeError: BcMath\Number::sub(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
@@ -66,11 +66,11 @@ Deprecated: BcMath\Number::sub(): Passing null to parameter #1 ($num) of type Bc
 
 ========== mul ==========
 non number str:
-BcMath\Number::mul(): Argument #1 ($num) is not well-formed
+ValueError: BcMath\Number::mul(): Argument #1 ($num) is not well-formed
 array:
-BcMath\Number::mul(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
+TypeError: BcMath\Number::mul(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
 other object:
-BcMath\Number::mul(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
+TypeError: BcMath\Number::mul(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
@@ -80,43 +80,43 @@ Deprecated: BcMath\Number::mul(): Passing null to parameter #1 ($num) of type Bc
 
 ========== div ==========
 non number str:
-BcMath\Number::div(): Argument #1 ($num) is not well-formed
+ValueError: BcMath\Number::div(): Argument #1 ($num) is not well-formed
 array:
-BcMath\Number::div(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
+TypeError: BcMath\Number::div(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
 other object:
-BcMath\Number::div(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
+TypeError: BcMath\Number::div(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
-Division by zero
+DivisionByZeroError: Division by zero
 null:
 
 Deprecated: BcMath\Number::div(): Passing null to parameter #1 ($num) of type BcMath\Number|string|int is deprecated in %s
-Division by zero
+DivisionByZeroError: Division by zero
 
 ========== mod ==========
 non number str:
-BcMath\Number::mod(): Argument #1 ($num) is not well-formed
+ValueError: BcMath\Number::mod(): Argument #1 ($num) is not well-formed
 array:
-BcMath\Number::mod(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
+TypeError: BcMath\Number::mod(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
 other object:
-BcMath\Number::mod(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
+TypeError: BcMath\Number::mod(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
-Modulo by zero
+DivisionByZeroError: Modulo by zero
 null:
 
 Deprecated: BcMath\Number::mod(): Passing null to parameter #1 ($num) of type BcMath\Number|string|int is deprecated in %s
-Modulo by zero
+DivisionByZeroError: Modulo by zero
 
 ========== pow ==========
 non number str:
-BcMath\Number::pow(): Argument #1 ($exponent) is not well-formed
+ValueError: BcMath\Number::pow(): Argument #1 ($exponent) is not well-formed
 array:
-BcMath\Number::pow(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, array given
+TypeError: BcMath\Number::pow(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, array given
 other object:
-BcMath\Number::pow(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, stdClass given
+TypeError: BcMath\Number::pow(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
diff --git a/ext/bcmath/tests/number/methods/calc_methods_scale_arg_error.phpt b/ext/bcmath/tests/number/methods/calc_methods_scale_arg_error.phpt
index 35e789f9c103..479e205757b1 100644
--- a/ext/bcmath/tests/number/methods/calc_methods_scale_arg_error.phpt
+++ b/ext/bcmath/tests/number/methods/calc_methods_scale_arg_error.phpt
@@ -26,8 +26,8 @@ foreach ($methods as $method) {
         echo "{$type}:\n";
         try {
             $num->$method(1, $val);
-        } catch (Error $e) {
-            echo $e->getMessage() . "\n";
+        } catch (Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
     echo "\n";
@@ -36,54 +36,54 @@ foreach ($methods as $method) {
 --EXPECTF--
 ========== add ==========
 array:
-BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, array given
+TypeError: BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, array given
 other object:
-BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, stdClass given
+TypeError: BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
 
 ========== sub ==========
 array:
-BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, array given
+TypeError: BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, array given
 other object:
-BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, stdClass given
+TypeError: BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
 
 ========== mul ==========
 array:
-BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, array given
+TypeError: BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, array given
 other object:
-BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, stdClass given
+TypeError: BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
 
 ========== div ==========
 array:
-BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, array given
+TypeError: BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, array given
 other object:
-BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, stdClass given
+TypeError: BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
 
 ========== mod ==========
 array:
-BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, array given
+TypeError: BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, array given
 other object:
-BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, stdClass given
+TypeError: BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
 
 ========== pow ==========
 array:
-BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, array given
+TypeError: BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, array given
 other object:
-BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, stdClass given
+TypeError: BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
diff --git a/ext/bcmath/tests/number/methods/compare_arg_error.phpt b/ext/bcmath/tests/number/methods/compare_arg_error.phpt
index bf714304d7fd..6af3753f4945 100644
--- a/ext/bcmath/tests/number/methods/compare_arg_error.phpt
+++ b/ext/bcmath/tests/number/methods/compare_arg_error.phpt
@@ -17,21 +17,21 @@ foreach ($args as [$val, $type]) {
     echo "{$type}:\n";
     try {
         $num->compare($val);
-    } catch (Error $e) {
-        echo $e->getMessage() . "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     echo "\n";
 }
 ?>
 --EXPECTF--
 non number str:
-BcMath\Number::compare(): Argument #1 ($num) is not well-formed
+ValueError: BcMath\Number::compare(): Argument #1 ($num) is not well-formed
 
 array:
-BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
+TypeError: BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given
 
 other object:
-BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
+TypeError: BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given
 
 float:
 
diff --git a/ext/bcmath/tests/number/methods/pow_div_by_zero.phpt b/ext/bcmath/tests/number/methods/pow_div_by_zero.phpt
index 6a7099b1c30e..b15005fc4152 100644
--- a/ext/bcmath/tests/number/methods/pow_div_by_zero.phpt
+++ b/ext/bcmath/tests/number/methods/pow_div_by_zero.phpt
@@ -20,22 +20,22 @@ foreach ($values as $value) {
         echo "{$value} ** {$exponent}: {$type}\n";
         try {
             $num->pow($exponent);
-        } catch (Error $e) {
-            echo $e->getMessage() . "\n";
+        } catch (Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
 }
 ?>
 --EXPECT--
 0 ** -3: int
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -2: string
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -2: object
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -3: int
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -2: string
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -2: object
-Negative power of zero
+DivisionByZeroError: Negative power of zero
diff --git a/ext/bcmath/tests/number/methods/powmod_arg_error.phpt b/ext/bcmath/tests/number/methods/powmod_arg_error.phpt
index 796769e1e6c4..3b3069296d67 100644
--- a/ext/bcmath/tests/number/methods/powmod_arg_error.phpt
+++ b/ext/bcmath/tests/number/methods/powmod_arg_error.phpt
@@ -19,8 +19,8 @@ foreach ($args as [$val, $type]) {
     echo "{$type}:\n";
     try {
         $num->powmod($val, 1);
-    } catch (Error $e) {
-        echo $e->getMessage() . "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }
 
@@ -31,19 +31,19 @@ foreach ($args as [$val, $type]) {
     echo "{$type}:\n";
     try {
         $num->powmod(1, $val);
-    } catch (Error $e) {
-        echo $e->getMessage() . "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }
 ?>
 --EXPECTF--
 ========== check 1st arg ==========
 non number str:
-BcMath\Number::powmod(): Argument #1 ($exponent) is not well-formed
+ValueError: BcMath\Number::powmod(): Argument #1 ($exponent) is not well-formed
 array:
-BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, array given
+TypeError: BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, array given
 other object:
-BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, stdClass given
+TypeError: BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
@@ -53,16 +53,16 @@ Deprecated: BcMath\Number::powmod(): Passing null to parameter #1 ($exponent) of
 
 ========== check 2nd arg ==========
 non number str:
-BcMath\Number::powmod(): Argument #2 ($modulus) is not well-formed
+ValueError: BcMath\Number::powmod(): Argument #2 ($modulus) is not well-formed
 array:
-BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, array given
+TypeError: BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, array given
 other object:
-BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, stdClass given
+TypeError: BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, stdClass given
 float:
 
 Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
-Modulo by zero
+DivisionByZeroError: Modulo by zero
 null:
 
 Deprecated: BcMath\Number::powmod(): Passing null to parameter #2 ($modulus) of type BcMath\Number|string|int is deprecated in %s
-Modulo by zero
+DivisionByZeroError: Modulo by zero
diff --git a/ext/bcmath/tests/number/operators/calc_array.phpt b/ext/bcmath/tests/number/operators/calc_array.phpt
index 31acfb3ad118..4e6389d8bb92 100644
--- a/ext/bcmath/tests/number/operators/calc_array.phpt
+++ b/ext/bcmath/tests/number/operators/calc_array.phpt
@@ -9,44 +9,44 @@ $array = [1];
 
 try {
     $num + $array;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num - $array;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num * $array;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num / $array;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num % $array;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num ** $array;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Unsupported operand types: BcMath\Number + array
-Unsupported operand types: BcMath\Number - array
-Unsupported operand types: BcMath\Number * array
-Unsupported operand types: BcMath\Number / array
-Unsupported operand types: BcMath\Number % array
-Unsupported operand types: BcMath\Number ** array
+TypeError: Unsupported operand types: BcMath\Number + array
+TypeError: Unsupported operand types: BcMath\Number - array
+TypeError: Unsupported operand types: BcMath\Number * array
+TypeError: Unsupported operand types: BcMath\Number / array
+TypeError: Unsupported operand types: BcMath\Number % array
+TypeError: Unsupported operand types: BcMath\Number ** array
diff --git a/ext/bcmath/tests/number/operators/calc_non_numeric_string.phpt b/ext/bcmath/tests/number/operators/calc_non_numeric_string.phpt
index d9fe499d921d..ebdd9867994a 100644
--- a/ext/bcmath/tests/number/operators/calc_non_numeric_string.phpt
+++ b/ext/bcmath/tests/number/operators/calc_non_numeric_string.phpt
@@ -8,44 +8,44 @@ $num = new BcMath\Number(100);
 
 try {
     $num + 'a';
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num - 'a';
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num * 'a';
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num / 'a';
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num % 'a';
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num ** 'a';
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Right string operand cannot be converted to BcMath\Number
-Right string operand cannot be converted to BcMath\Number
-Right string operand cannot be converted to BcMath\Number
-Right string operand cannot be converted to BcMath\Number
-Right string operand cannot be converted to BcMath\Number
-Right string operand cannot be converted to BcMath\Number
+ValueError: Right string operand cannot be converted to BcMath\Number
+ValueError: Right string operand cannot be converted to BcMath\Number
+ValueError: Right string operand cannot be converted to BcMath\Number
+ValueError: Right string operand cannot be converted to BcMath\Number
+ValueError: Right string operand cannot be converted to BcMath\Number
+ValueError: Right string operand cannot be converted to BcMath\Number
diff --git a/ext/bcmath/tests/number/operators/calc_null.phpt b/ext/bcmath/tests/number/operators/calc_null.phpt
index a5745dc5e762..46a3b8bf4a43 100644
--- a/ext/bcmath/tests/number/operators/calc_null.phpt
+++ b/ext/bcmath/tests/number/operators/calc_null.phpt
@@ -8,44 +8,44 @@ $num = new BcMath\Number(100);
 
 try {
     $num + null;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num - null;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num * null;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num / null;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num % null;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num ** null;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Unsupported operand types: BcMath\Number + null
-Unsupported operand types: BcMath\Number - null
-Unsupported operand types: BcMath\Number * null
-Unsupported operand types: BcMath\Number / null
-Unsupported operand types: BcMath\Number % null
-Unsupported operand types: BcMath\Number ** null
+TypeError: Unsupported operand types: BcMath\Number + null
+TypeError: Unsupported operand types: BcMath\Number - null
+TypeError: Unsupported operand types: BcMath\Number * null
+TypeError: Unsupported operand types: BcMath\Number / null
+TypeError: Unsupported operand types: BcMath\Number % null
+TypeError: Unsupported operand types: BcMath\Number ** null
diff --git a/ext/bcmath/tests/number/operators/calc_other_class.phpt b/ext/bcmath/tests/number/operators/calc_other_class.phpt
index 5c6a11747def..4b1e6a9917a0 100644
--- a/ext/bcmath/tests/number/operators/calc_other_class.phpt
+++ b/ext/bcmath/tests/number/operators/calc_other_class.phpt
@@ -9,44 +9,44 @@ $other = new stdClass();
 
 try {
     $num + $other;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num - $other;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num * $other;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num / $other;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num % $other;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num ** $other;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Unsupported operand types: BcMath\Number + stdClass
-Unsupported operand types: BcMath\Number - stdClass
-Unsupported operand types: BcMath\Number * stdClass
-Unsupported operand types: BcMath\Number / stdClass
-Unsupported operand types: BcMath\Number % stdClass
-Unsupported operand types: BcMath\Number ** stdClass
+TypeError: Unsupported operand types: BcMath\Number + stdClass
+TypeError: Unsupported operand types: BcMath\Number - stdClass
+TypeError: Unsupported operand types: BcMath\Number * stdClass
+TypeError: Unsupported operand types: BcMath\Number / stdClass
+TypeError: Unsupported operand types: BcMath\Number % stdClass
+TypeError: Unsupported operand types: BcMath\Number ** stdClass
diff --git a/ext/bcmath/tests/number/operators/calc_undef.phpt b/ext/bcmath/tests/number/operators/calc_undef.phpt
index f7b188a8d211..90ce286229cb 100644
--- a/ext/bcmath/tests/number/operators/calc_undef.phpt
+++ b/ext/bcmath/tests/number/operators/calc_undef.phpt
@@ -8,55 +8,55 @@ $num = new BcMath\Number(100);
 
 try {
     $num + $undef;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num - $undef;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num * $undef;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num / $undef;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num % $undef;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num ** $undef;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECTF--
 Warning: Undefined variable $undef in %s
-Unsupported operand types: BcMath\Number + null
+TypeError: Unsupported operand types: BcMath\Number + null
 
 Warning: Undefined variable $undef in %s
-Unsupported operand types: BcMath\Number - null
+TypeError: Unsupported operand types: BcMath\Number - null
 
 Warning: Undefined variable $undef in %s
-Unsupported operand types: BcMath\Number * null
+TypeError: Unsupported operand types: BcMath\Number * null
 
 Warning: Undefined variable $undef in %s
-Unsupported operand types: BcMath\Number / null
+TypeError: Unsupported operand types: BcMath\Number / null
 
 Warning: Undefined variable $undef in %s
-Unsupported operand types: BcMath\Number % null
+TypeError: Unsupported operand types: BcMath\Number % null
 
 Warning: Undefined variable $undef in %s
-Unsupported operand types: BcMath\Number ** null
+TypeError: Unsupported operand types: BcMath\Number ** null
diff --git a/ext/bcmath/tests/number/operators/div_by_zero.phpt b/ext/bcmath/tests/number/operators/div_by_zero.phpt
index cadac7361a2f..16959d243a48 100644
--- a/ext/bcmath/tests/number/operators/div_by_zero.phpt
+++ b/ext/bcmath/tests/number/operators/div_by_zero.phpt
@@ -8,46 +8,46 @@ $num = new BcMath\Number(100);
 
 try {
     $num / 0;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num / '0';
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num / (new BcMath\Number(0));
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 $zero = new BcMath\Number(0);
 
 try {
     100 / $zero;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     '100' / $zero;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num / $zero;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Division by zero
-Division by zero
-Division by zero
-Division by zero
-Division by zero
-Division by zero
+DivisionByZeroError: Division by zero
+DivisionByZeroError: Division by zero
+DivisionByZeroError: Division by zero
+DivisionByZeroError: Division by zero
+DivisionByZeroError: Division by zero
+DivisionByZeroError: Division by zero
diff --git a/ext/bcmath/tests/number/operators/mod_by_zero.phpt b/ext/bcmath/tests/number/operators/mod_by_zero.phpt
index 9c1e08f6a4dc..58232fba0122 100644
--- a/ext/bcmath/tests/number/operators/mod_by_zero.phpt
+++ b/ext/bcmath/tests/number/operators/mod_by_zero.phpt
@@ -8,46 +8,46 @@ $num = new BcMath\Number(100);
 
 try {
     $num % 0;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num % '0';
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num % (new BcMath\Number(0));
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 $zero = new BcMath\Number(0);
 
 try {
     100 % $zero;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     '100' % $zero;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num % $zero;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Modulo by zero
-Modulo by zero
-Modulo by zero
-Modulo by zero
-Modulo by zero
-Modulo by zero
+DivisionByZeroError: Modulo by zero
+DivisionByZeroError: Modulo by zero
+DivisionByZeroError: Modulo by zero
+DivisionByZeroError: Modulo by zero
+DivisionByZeroError: Modulo by zero
+DivisionByZeroError: Modulo by zero
diff --git a/ext/bcmath/tests/number/operators/pow_div_by_zero.phpt b/ext/bcmath/tests/number/operators/pow_div_by_zero.phpt
index ff03626fca60..7dd98fdea61e 100644
--- a/ext/bcmath/tests/number/operators/pow_div_by_zero.phpt
+++ b/ext/bcmath/tests/number/operators/pow_div_by_zero.phpt
@@ -20,22 +20,22 @@ foreach ($values as $value) {
         echo "{$value} ** {$exponent}: {$type}\n";
         try {
             $num ** $exponent;
-        } catch (Error $e) {
-            echo $e->getMessage() . "\n";
+        } catch (Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
 }
 ?>
 --EXPECT--
 0 ** -3: int
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -2: string
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -2: object
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -3: int
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -2: string
-Negative power of zero
+DivisionByZeroError: Negative power of zero
 0 ** -2: object
-Negative power of zero
+DivisionByZeroError: Negative power of zero
diff --git a/ext/bcmath/tests/number/properties_unknown.phpt b/ext/bcmath/tests/number/properties_unknown.phpt
index cd1c13eb0c74..f98e97477a57 100644
--- a/ext/bcmath/tests/number/properties_unknown.phpt
+++ b/ext/bcmath/tests/number/properties_unknown.phpt
@@ -11,16 +11,16 @@ var_dump($num->foo);
 
 try {
     $num->foo = 1;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 var_dump($num->foo);
 
 try {
     $num->bar = 1;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 var_dump(isset($num->foo));
@@ -28,9 +28,9 @@ var_dump(isset($num->foo));
 --EXPECTF--
 Warning: Undefined property: BcMath\Number::$foo in %s
 NULL
-Cannot create dynamic property BcMath\Number::$foo
+Error: Cannot create dynamic property BcMath\Number::$foo
 
 Warning: Undefined property: BcMath\Number::$foo in %s
 NULL
-Cannot create dynamic property BcMath\Number::$bar
+Error: Cannot create dynamic property BcMath\Number::$bar
 bool(false)
diff --git a/ext/bcmath/tests/number/properties_unset.phpt b/ext/bcmath/tests/number/properties_unset.phpt
index ce21350240bb..12dcf4b6e686 100644
--- a/ext/bcmath/tests/number/properties_unset.phpt
+++ b/ext/bcmath/tests/number/properties_unset.phpt
@@ -8,16 +8,16 @@ bcmath
 $num = new BcMath\Number(1);
 try {
     unset($num->value);
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     unset($num->scale);
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Cannot unset readonly property BcMath\Number::$value
-Cannot unset readonly property BcMath\Number::$scale
+Error: Cannot unset readonly property BcMath\Number::$value
+Error: Cannot unset readonly property BcMath\Number::$scale
diff --git a/ext/bcmath/tests/number/properties_write_error.phpt b/ext/bcmath/tests/number/properties_write_error.phpt
index 03683c4c0926..f92cccf2e125 100644
--- a/ext/bcmath/tests/number/properties_write_error.phpt
+++ b/ext/bcmath/tests/number/properties_write_error.phpt
@@ -8,16 +8,16 @@ bcmath
 $num = new BcMath\Number(1);
 try {
     $num->value = 1;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     $num->scale = 1;
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Cannot modify readonly property BcMath\Number::$value
-Cannot modify readonly property BcMath\Number::$scale
+Error: Cannot modify readonly property BcMath\Number::$value
+Error: Cannot modify readonly property BcMath\Number::$scale
diff --git a/ext/bcmath/tests/number/unserialize_error.phpt b/ext/bcmath/tests/number/unserialize_error.phpt
index 030ba1232d06..8351fe72336a 100644
--- a/ext/bcmath/tests/number/unserialize_error.phpt
+++ b/ext/bcmath/tests/number/unserialize_error.phpt
@@ -7,8 +7,8 @@ bcmath
 try {
     $num = new BcMath\Number(1);
     $num->__unserialize(['value' => '5']);
-} catch (Error $e) {
-    echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 echo "\n";
@@ -22,15 +22,15 @@ $cases = [
 foreach ($cases as $case) {
     try {
         unserialize($case);
-    } catch (Exception $e) {
-        echo $e->getMessage() . "\n";
+    } catch (Throwable $e) {
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }
 ?>
 --EXPECT--
-Cannot modify readonly property BcMath\Number::$value
+Error: Cannot modify readonly property BcMath\Number::$value
 
-Invalid serialization data for BcMath\Number object
-Invalid serialization data for BcMath\Number object
-Invalid serialization data for BcMath\Number object
-Invalid serialization data for BcMath\Number object
+Exception: Invalid serialization data for BcMath\Number object
+Exception: Invalid serialization data for BcMath\Number object
+Exception: Invalid serialization data for BcMath\Number object
+Exception: Invalid serialization data for BcMath\Number object
diff --git a/ext/bcmath/tests/sec_embedded_null_truncation.phpt b/ext/bcmath/tests/sec_embedded_null_truncation.phpt
index 157810ecbb3a..20e3cf432ce2 100644
--- a/ext/bcmath/tests/sec_embedded_null_truncation.phpt
+++ b/ext/bcmath/tests/sec_embedded_null_truncation.phpt
@@ -26,34 +26,34 @@ foreach ($cases as $s) {
         try {
             $fn($s);
             echo "FAIL: accepted\n";
-        } catch (\ValueError $e) {
-            echo $e->getMessage() . "\n";
+        } catch (\Throwable $e) {
+            echo $e::class, ': ', $e->getMessage(), "\n";
         }
     }
 }
 ?>
 --EXPECT--
-bcadd(): Argument #1 ($num1) is not well-formed
-bcsub(): Argument #1 ($num1) is not well-formed
-bcmul(): Argument #1 ($num1) is not well-formed
-bcdiv(): Argument #1 ($num1) is not well-formed
-bcmod(): Argument #1 ($num1) is not well-formed
-bcpow(): Argument #1 ($num) is not well-formed
-bccomp(): Argument #1 ($num1) is not well-formed
-bcsqrt(): Argument #1 ($num) is not well-formed
-bcadd(): Argument #1 ($num1) is not well-formed
-bcsub(): Argument #1 ($num1) is not well-formed
-bcmul(): Argument #1 ($num1) is not well-formed
-bcdiv(): Argument #1 ($num1) is not well-formed
-bcmod(): Argument #1 ($num1) is not well-formed
-bcpow(): Argument #1 ($num) is not well-formed
-bccomp(): Argument #1 ($num1) is not well-formed
-bcsqrt(): Argument #1 ($num) is not well-formed
-bcadd(): Argument #1 ($num1) is not well-formed
-bcsub(): Argument #1 ($num1) is not well-formed
-bcmul(): Argument #1 ($num1) is not well-formed
-bcdiv(): Argument #1 ($num1) is not well-formed
-bcmod(): Argument #1 ($num1) is not well-formed
-bcpow(): Argument #1 ($num) is not well-formed
-bccomp(): Argument #1 ($num1) is not well-formed
-bcsqrt(): Argument #1 ($num) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcsub(): Argument #1 ($num1) is not well-formed
+ValueError: bcmul(): Argument #1 ($num1) is not well-formed
+ValueError: bcdiv(): Argument #1 ($num1) is not well-formed
+ValueError: bcmod(): Argument #1 ($num1) is not well-formed
+ValueError: bcpow(): Argument #1 ($num) is not well-formed
+ValueError: bccomp(): Argument #1 ($num1) is not well-formed
+ValueError: bcsqrt(): Argument #1 ($num) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcsub(): Argument #1 ($num1) is not well-formed
+ValueError: bcmul(): Argument #1 ($num1) is not well-formed
+ValueError: bcdiv(): Argument #1 ($num1) is not well-formed
+ValueError: bcmod(): Argument #1 ($num1) is not well-formed
+ValueError: bcpow(): Argument #1 ($num) is not well-formed
+ValueError: bccomp(): Argument #1 ($num1) is not well-formed
+ValueError: bcsqrt(): Argument #1 ($num) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcsub(): Argument #1 ($num1) is not well-formed
+ValueError: bcmul(): Argument #1 ($num1) is not well-formed
+ValueError: bcdiv(): Argument #1 ($num1) is not well-formed
+ValueError: bcmod(): Argument #1 ($num1) is not well-formed
+ValueError: bcpow(): Argument #1 ($num) is not well-formed
+ValueError: bccomp(): Argument #1 ($num1) is not well-formed
+ValueError: bcsqrt(): Argument #1 ($num) is not well-formed
diff --git a/ext/bcmath/tests/str2num_formatting.phpt b/ext/bcmath/tests/str2num_formatting.phpt
index 4b77381de868..3cf4e5fc67a1 100644
--- a/ext/bcmath/tests/str2num_formatting.phpt
+++ b/ext/bcmath/tests/str2num_formatting.phpt
@@ -18,38 +18,38 @@ echo "\n";
 
 try {
     echo bcadd(" 0", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     echo bcadd("1e1", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     echo bcadd("1,1", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     echo bcadd("Hello", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     echo bcadd("1 1", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     echo bcadd("1.a", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 echo "\n";
@@ -64,32 +64,32 @@ echo "\n";
 
 try {
     echo bccomp(" 0", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     echo bccomp("1e1", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     echo bccomp("1,1", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     echo bccomp("Hello", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     echo bccomp("1 1", "2");
-} catch (\ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+} catch (\Throwable $e) {
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
@@ -100,12 +100,12 @@ try {
 2
 2
 
-bcadd(): Argument #1 ($num1) is not well-formed
-bcadd(): Argument #1 ($num1) is not well-formed
-bcadd(): Argument #1 ($num1) is not well-formed
-bcadd(): Argument #1 ($num1) is not well-formed
-bcadd(): Argument #1 ($num1) is not well-formed
-bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
+ValueError: bcadd(): Argument #1 ($num1) is not well-formed
 
 -1
 -1
@@ -113,8 +113,8 @@ bcadd(): Argument #1 ($num1) is not well-formed
 -1
 -1
 
-bccomp(): Argument #1 ($num1) is not well-formed
-bccomp(): Argument #1 ($num1) is not well-formed
-bccomp(): Argument #1 ($num1) is not well-formed
-bccomp(): Argument #1 ($num1) is not well-formed
-bccomp(): Argument #1 ($num1) is not well-formed
+ValueError: bccomp(): Argument #1 ($num1) is not well-formed
+ValueError: bccomp(): Argument #1 ($num1) is not well-formed
+ValueError: bccomp(): Argument #1 ($num1) is not well-formed
+ValueError: bccomp(): Argument #1 ($num1) is not well-formed
+ValueError: bccomp(): Argument #1 ($num1) is not well-formed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.