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
commitb141fb1afb2919e54f3d4f795797726cfe43245c (patch)
tree02f8ab128650299579b55162d1f28f9c1af01ac1
parent7439154ece68756ac51560a74c6d915735164bd9 (diff)
downloadphp-git-b141fb1afb2919e54f3d4f795797726cfe43245c.tar.gz
- Fixed bug #60337 bcscale related crashed on 64bits platforms
-rw-r--r--NEWS2
-rw-r--r--ext/bcmath/bcmath.c2
-rw-r--r--ext/bcmath/tests/bug60377.phpt13
3 files changed, 16 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 86840851bd..657d4f6b5e 100644
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,8 @@ PHP NEWS
. Remove EXPERIMENTAL flag. (fat)
. Added .phar to default authorized extensions. (fat)
+- BCmath:
+ . Fixed bug #60377 (bcscale related crashes on 64bits platforms) (shm)
11 Nov 2011, PHP 5.4.0 RC1
- General improvements:
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