summaryrefslogtreecommitdiff
path: root/ext/bcmath/tests
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2016-04-24 18:33:32 -0700
committerStanislav Malyshev <stas@php.net>2016-04-24 18:33:32 -0700
commitd650063a0457aec56364e4005a636dc6c401f9cd (patch)
tree11e7ad7d719fa488d92cb802a0b2234e96b29268 /ext/bcmath/tests
parentfd9689745c44341b1bd6af4756f324be8abba2fb (diff)
downloadphp-git-d650063a0457aec56364e4005a636dc6c401f9cd.tar.gz
Fix bug #72093: bcpowmod accepts negative scale and corrupts _one_ definition
We can not modify result since it can be copy of _zero_ or _one_, etc. and "copy" in bcmath is just bumping the refcount.
Diffstat (limited to 'ext/bcmath/tests')
-rw-r--r--ext/bcmath/tests/bug72093.phpt13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/bcmath/tests/bug72093.phpt b/ext/bcmath/tests/bug72093.phpt
new file mode 100644
index 0000000000..be664b8114
--- /dev/null
+++ b/ext/bcmath/tests/bug72093.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+var_dump(bcpowmod(1, "A", 128, -200));
+var_dump(bcpowmod(1, 1.2, 1, 1));
+?>
+--EXPECTF--
+string(1) "1"
+bc math warning: non-zero scale in exponent
+string(3) "0.0"