diff --git a/ext/bcmath/tests/bcdivmod_error.phpt b/ext/bcmath/tests/bcdivmod_error.phpt new file mode 100644 index 000000000000..8690796f7f57 --- /dev/null +++ b/ext/bcmath/tests/bcdivmod_error.phpt @@ -0,0 +1,23 @@ +--TEST-- +bcdivmod() requires well-formed values +--EXTENSIONS-- +bcmath +--FILE-- +getMessage(), "\n"; +} + +try { + bcdivmod('1', 'a'); +} catch (\Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +ValueError: bcdivmod(): Argument #1 ($num1) is not well-formed +ValueError: bcdivmod(): Argument #2 ($num2) is not well-formed diff --git a/ext/bcmath/tests/negative_scale.phpt b/ext/bcmath/tests/negative_scale.phpt index 3b9377559098..d911f01e279f 100644 --- a/ext/bcmath/tests/negative_scale.phpt +++ b/ext/bcmath/tests/negative_scale.phpt @@ -8,63 +8,69 @@ bcmath.scale=0 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 { + bcdivmod('1','2',-1); +} 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: bcdivmod(): 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