-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
Since `bcpowmod()` does not support non-integral operands, we have to truncate these in addition to emitting a respective warning. We also have to work with the truncated values in the following. We recognize that the division by one to enforce the truncation is actually overkill, but we stick with it for now, and shall tackle the issue for PHP 7.3.
- Loading branch information
Showing
3 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--TEST-- | ||
Bug #75178 (bcpowmod() misbehaves for non-integer base or modulus) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available'); | ||
?> | ||
--FILE-- | ||
<?php | ||
var_dump(bcpowmod('4.1', '4', '3', 3)); | ||
var_dump(bcpowmod('4', '4', '3.1', 3)); | ||
?> | ||
===DONE=== | ||
--EXPECT-- | ||
bc math warning: non-zero scale in base | ||
string(5) "1.000" | ||
bc math warning: non-zero scale in modulus | ||
string(5) "1.000" | ||
===DONE=== |