1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/bcmath/tests/bcmod_error2.phpt
Christoph M. Becker 84f2a984d4 Elevate warnings to Error Exceptions in ext/bcmath
`bcdiv()` and `bcmod()` throw DivisionByZeroError if the divisor is 0,
which matches the behavior of the `/` and `%` operators, and `bcsqrt()`
throws ValueError for negative operands.
2019-10-28 12:22:31 +01:00

17 lines
264 B
PHP

--TEST--
bcmod() - mod by 0
--SKIPIF--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
--FILE--
<?php
try {
bcmod("10", "0");
} catch (DivisionByZeroError $ex) {
echo $ex->getMessage(), PHP_EOL;
}
?>
--EXPECT--
Modulo by zero