summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Kocielski <shm@php.net>2011-11-19 12:46:43 +0000
committerMateusz Kocielski <shm@php.net>2011-11-19 12:46:43 +0000
commit63b8ff76198e886133d28987d49dc1358629e814 (patch)
tree1b91458d5f4481b3b4867346110e383eb93851f9
parent22028c78f82371f8fb2f7ab94b69c21383aa2647 (diff)
downloadphp-git-63b8ff76198e886133d28987d49dc1358629e814.tar.gz
- Fixed bug #60337 bcscale related crashed on 64bits platforms
-rw-r--r--ext/bcmath/bcmath.c2
-rw-r--r--ext/bcmath/tests/bug60377.phpt13
2 files changed, 14 insertions, 1 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index f42d3363b3..bd9d6608a3 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -560,7 +560,7 @@ PHP_FUNCTION(bcscale)
return;
}
- BCG(bc_precision) = (new_scale < 0) ? 0 : new_scale;
+ BCG(bc_precision) = ((int)new_scale < 0) ? 0 : new_scale;
RETURN_TRUE;
}
diff --git a/ext/bcmath/tests/bug60377.phpt b/ext/bcmath/tests/bug60377.phpt
new file mode 100644
index 0000000000..7c42002917
--- /dev/null
+++ b/ext/bcmath/tests/bug60377.phpt
@@ -0,0 +1,13 @@
+--TEST--
+bcscale related problem on 64bits platforms
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+$var48 = bcscale(634314234334311);
+$var67 = bcsqrt(false);
+$var414 = bcadd(false,null,10);
+die('ALIVE');
+?>
+--EXPECTF--
+ALIVE