summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2017-09-06 23:32:41 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2017-09-06 23:33:48 +0200
commitd724d8c1076dc6e7ca5665fe68753e71440655c1 (patch)
tree3019216f2ab3e51038d066631512e0c1172c134b
parent0b69ce72b8a5679054b62aa1ec5b13bc1c78cfa8 (diff)
parentdea41f3c3a003a22893b27eead429f963d3230c3 (diff)
downloadphp-git-d724d8c1076dc6e7ca5665fe68753e71440655c1.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fixed bug #44995 (bcpowmod() fails if scale != 0)
-rw-r--r--NEWS3
-rw-r--r--ext/bcmath/libbcmath/src/divmod.c2
-rw-r--r--ext/bcmath/tests/bug44995.phpt16
3 files changed, 20 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index e816b23f04..79df915b5b 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ PHP NEWS
- Core:
. Fixed #75042 run-tests.php issues with EXTENSION block). (John Boehr)
+- BCMath:
+ . Fixed bug #44995 (bcpowmod() fails if scale != 0). (cmb)
+
- CLI server:
. Fixed bug #70470 (Built-in server truncates headers spanning over TCP
packets). (bouk)
diff --git a/ext/bcmath/libbcmath/src/divmod.c b/ext/bcmath/libbcmath/src/divmod.c
index d7aaa3509d..08c2f8a2a2 100644
--- a/ext/bcmath/libbcmath/src/divmod.c
+++ b/ext/bcmath/libbcmath/src/divmod.c
@@ -59,7 +59,7 @@ bc_divmod (bc_num num1, bc_num num2, bc_num *quot, bc_num *rem, int scale)
bc_init_num(&temp);
/* Calculate it. */
- bc_divide (num1, num2, &temp, scale);
+ bc_divide (num1, num2, &temp, 0);
if (quot)
quotient = bc_copy_num (temp);
bc_multiply (temp, num2, &temp, rscale);
diff --git a/ext/bcmath/tests/bug44995.phpt b/ext/bcmath/tests/bug44995.phpt
new file mode 100644
index 0000000000..6eb591f92b
--- /dev/null
+++ b/ext/bcmath/tests/bug44995.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #44995 (bcpowmod() fails if scale != 0)
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+var_dump(bcpowmod('4', '4', '3', 1));
+var_dump(bcpowmod('3234', '32345', '22345', 1));
+?>
+===DONE===
+--EXPECT--
+string(3) "1.0"
+string(7) "17334.0"
+===DONE===