xref: /PHP-8.0/ext/bcmath/tests/bug72093.phpt (revision cd05b56a)
1--TEST--
2Bug 72093: bcpowmod fails on negative scale and corrupts _one_ definition
3--SKIPIF--
4<?php
5if(!extension_loaded("bcmath")) print "skip";
6?>
7--FILE--
8<?php
9try {
10    var_dump(bcpowmod(1, 0, 128, -200));
11} catch (\ValueError $e) {
12    echo $e->getMessage() . \PHP_EOL;
13}
14try {
15    var_dump(bcpowmod(1, 1.2, 1, 1));
16} catch (\ValueError $e) {
17    echo $e->getMessage() . \PHP_EOL;
18}
19?>
20--EXPECT--
21bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647
22bcpowmod(): Argument #2 ($exponent) cannot have a fractional part
23