Commit 7ca205842e1 for php.net
commit 7ca205842e164cb12253c760489e5348cf54e397
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Sat Aug 22 20:08:15 2026 +0700
ext/bcmath: applied fixers to improve test robustness (#23129)
diff --git a/ext/bcmath/tests/bcadd_error.phpt b/ext/bcmath/tests/bcadd_error.phpt
index 320bf390680..77cb46c18c1 100644
--- a/ext/bcmath/tests/bcadd_error.phpt
+++ b/ext/bcmath/tests/bcadd_error.phpt
@@ -7,17 +7,17 @@
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 fd4c51ff6c5..58df0fdce60 100644
--- a/ext/bcmath/tests/bcceil_error.phpt
+++ b/ext/bcmath/tests/bcceil_error.phpt
@@ -7,15 +7,15 @@
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 90645c52f7e..5cc2c2f4ca0 100644
--- a/ext/bcmath/tests/bccomp_error.phpt
+++ b/ext/bcmath/tests/bccomp_error.phpt
@@ -7,17 +7,17 @@
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 b6af64d69af..154f20e52d8 100644
--- a/ext/bcmath/tests/bcdiv_error1.phpt
+++ b/ext/bcmath/tests/bcdiv_error1.phpt
@@ -10,23 +10,23 @@
<?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 a4e1cae3535..622760327c5 100644
--- a/ext/bcmath/tests/bcdiv_error2.phpt
+++ b/ext/bcmath/tests/bcdiv_error2.phpt
@@ -7,17 +7,17 @@
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 7578a5afe3b..28556b366aa 100644
--- a/ext/bcmath/tests/bcfloor_error.phpt
+++ b/ext/bcmath/tests/bcfloor_error.phpt
@@ -7,15 +7,15 @@
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 37c433fbb89..f3cb6074cb2 100644
--- a/ext/bcmath/tests/bcmod_error2.phpt
+++ b/ext/bcmath/tests/bcmod_error2.phpt
@@ -8,21 +8,21 @@
<?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 8df986fe765..ee8768f90e7 100644
--- a/ext/bcmath/tests/bcmod_error3.phpt
+++ b/ext/bcmath/tests/bcmod_error3.phpt
@@ -7,17 +7,17 @@
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 361b46163ee..b1a6364c6a6 100644
--- a/ext/bcmath/tests/bcmul_error.phpt
+++ b/ext/bcmath/tests/bcmul_error.phpt
@@ -7,17 +7,17 @@
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 ac1e8187450..1d6fb2b7d2f 100644
--- a/ext/bcmath/tests/bcpow_div_by_zero.phpt
+++ b/ext/bcmath/tests/bcpow_div_by_zero.phpt
@@ -13,17 +13,17 @@
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 fefdfc57a01..0a78b4bdeb5 100644
--- a/ext/bcmath/tests/bcpow_error1.phpt
+++ b/ext/bcmath/tests/bcpow_error1.phpt
@@ -6,15 +6,15 @@
<?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 f9b830ca7d5..a959a37399e 100644
--- a/ext/bcmath/tests/bcpow_error2.phpt
+++ b/ext/bcmath/tests/bcpow_error2.phpt
@@ -6,16 +6,16 @@
<?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 f47c85d4da8..1c97cce12b6 100644
--- a/ext/bcmath/tests/bcpow_error3.phpt
+++ b/ext/bcmath/tests/bcpow_error3.phpt
@@ -7,17 +7,17 @@
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 ff2862310cb..99ba973a1df 100644
--- a/ext/bcmath/tests/bcpowmod_error.phpt
+++ b/ext/bcmath/tests/bcpowmod_error.phpt
@@ -7,24 +7,24 @@
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 7814e2bd41d..6589177046f 100644
--- a/ext/bcmath/tests/bcpowmod_negative_exponent.phpt
+++ b/ext/bcmath/tests/bcpowmod_negative_exponent.phpt
@@ -8,9 +8,9 @@
<?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 8540a0d6df3..cf757b07757 100644
--- a/ext/bcmath/tests/bcpowmod_zero_modulus.phpt
+++ b/ext/bcmath/tests/bcpowmod_zero_modulus.phpt
@@ -8,9 +8,9 @@
<?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 95579a4edf0..fe114cf8bba 100644
--- a/ext/bcmath/tests/bcround_error.phpt
+++ b/ext/bcmath/tests/bcround_error.phpt
@@ -7,15 +7,15 @@
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 4c4f910476a..ad1d6c9fc0f 100644
--- a/ext/bcmath/tests/bcround_precision_bounds.phpt
+++ b/ext/bcmath/tests/bcround_precision_bounds.phpt
@@ -8,21 +8,21 @@
<?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 8d9d32e064b..e816c499fed 100644
--- a/ext/bcmath/tests/bcscale_variation001.phpt
+++ b/ext/bcmath/tests/bcscale_variation001.phpt
@@ -6,13 +6,13 @@
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 78923f4a948..9c8781923b3 100644
--- a/ext/bcmath/tests/bcsqrt_error1.phpt
+++ b/ext/bcmath/tests/bcsqrt_error1.phpt
@@ -9,9 +9,9 @@
<?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 1ef934d3bcf..7e58beca8fc 100644
--- a/ext/bcmath/tests/bcsqrt_error2.phpt
+++ b/ext/bcmath/tests/bcsqrt_error2.phpt
@@ -7,10 +7,10 @@
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 4e1abd3fa95..02942332641 100644
--- a/ext/bcmath/tests/bcsub_error.phpt
+++ b/ext/bcmath/tests/bcsub_error.phpt
@@ -7,17 +7,17 @@
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 16d058441a3..ed65e83838d 100644
--- a/ext/bcmath/tests/bug60377.phpt
+++ b/ext/bcmath/tests/bug60377.phpt
@@ -9,11 +9,11 @@
<?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 a424a59e047..68955985e7e 100644
--- a/ext/bcmath/tests/bug72093.phpt
+++ b/ext/bcmath/tests/bug72093.phpt
@@ -6,15 +6,15 @@
<?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 940a3567de1..b39c53dfd5d 100644
--- a/ext/bcmath/tests/bug75178.phpt
+++ b/ext/bcmath/tests/bug75178.phpt
@@ -6,15 +6,15 @@
<?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 9d9d0db48cf..7ecd7c151e5 100644
--- a/ext/bcmath/tests/bug78878.phpt
+++ b/ext/bcmath/tests/bug78878.phpt
@@ -6,9 +6,9 @@
<?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 f1e256776d9..7b76a883add 100644
--- a/ext/bcmath/tests/bug80545.phpt
+++ b/ext/bcmath/tests/bug80545.phpt
@@ -7,17 +7,17 @@
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 aa91534e773..4b12b0e6cc4 100644
--- a/ext/bcmath/tests/gh15968.phpt
+++ b/ext/bcmath/tests/gh15968.phpt
@@ -14,9 +14,9 @@ function __toString() {
$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 3b937755909..0b10fbfc1c3 100644
--- a/ext/bcmath/tests/negative_scale.phpt
+++ b/ext/bcmath/tests/negative_scale.phpt
@@ -8,63 +8,63 @@
<?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 0b49e871cea..0a05a0b5711 100644
--- a/ext/bcmath/tests/number/construct_error.phpt
+++ b/ext/bcmath/tests/number/construct_error.phpt
@@ -7,17 +7,17 @@
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 7f64f310113..256d73f16c3 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 @@
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 @@
--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 @@
========== 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 @@
========== 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 @@
========== 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 35e789f9c10..479e205757b 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 @@
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 @@
--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 bf714304d7f..6af3753f494 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 @@
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 6a7099b1c30..b15005fc415 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 @@
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 796769e1e6c..3b3069296d6 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 @@
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 @@
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 @@
========== 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 31acfb3ad11..4e6389d8bb9 100644
--- a/ext/bcmath/tests/number/operators/calc_array.phpt
+++ b/ext/bcmath/tests/number/operators/calc_array.phpt
@@ -9,44 +9,44 @@
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 d9fe499d921..ebdd9867994 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 @@
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 a5745dc5e76..46a3b8bf4a4 100644
--- a/ext/bcmath/tests/number/operators/calc_null.phpt
+++ b/ext/bcmath/tests/number/operators/calc_null.phpt
@@ -8,44 +8,44 @@
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 5c6a11747de..4b1e6a9917a 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 @@
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 f7b188a8d21..90ce286229c 100644
--- a/ext/bcmath/tests/number/operators/calc_undef.phpt
+++ b/ext/bcmath/tests/number/operators/calc_undef.phpt
@@ -8,55 +8,55 @@
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 cadac7361a2..16959d243a4 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 @@
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 9c1e08f6a4d..58232fba012 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 @@
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 ff03626fca6..7dd98fdea61 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 @@
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 cd1c13eb0c7..f98e97477a5 100644
--- a/ext/bcmath/tests/number/properties_unknown.phpt
+++ b/ext/bcmath/tests/number/properties_unknown.phpt
@@ -11,16 +11,16 @@
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 @@
--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 ce21350240b..12dcf4b6e68 100644
--- a/ext/bcmath/tests/number/properties_unset.phpt
+++ b/ext/bcmath/tests/number/properties_unset.phpt
@@ -8,16 +8,16 @@
$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 03683c4c092..f92cccf2e12 100644
--- a/ext/bcmath/tests/number/properties_write_error.phpt
+++ b/ext/bcmath/tests/number/properties_write_error.phpt
@@ -8,16 +8,16 @@
$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 030ba1232d0..8351fe72336 100644
--- a/ext/bcmath/tests/number/unserialize_error.phpt
+++ b/ext/bcmath/tests/number/unserialize_error.phpt
@@ -7,8 +7,8 @@
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 @@
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 157810ecbb3..20e3cf432ce 100644
--- a/ext/bcmath/tests/sec_embedded_null_truncation.phpt
+++ b/ext/bcmath/tests/sec_embedded_null_truncation.phpt
@@ -26,34 +26,34 @@
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 4b77381de86..3cf4e5fc67a 100644
--- a/ext/bcmath/tests/str2num_formatting.phpt
+++ b/ext/bcmath/tests/str2num_formatting.phpt
@@ -18,38 +18,38 @@
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 @@
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 @@
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 @@
-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