]> granicus.if.org Git - php/commitdiff
Fixed bug #64142 (dval to lval different behavior on ppc64)
authorRemi Collet <remi@php.net>
Mon, 4 Feb 2013 14:19:32 +0000 (15:19 +0100)
committerRemi Collet <remi@php.net>
Mon, 4 Feb 2013 14:19:32 +0000 (15:19 +0100)
On x86_64:
(long)(double)9223372036854775807+1 = -9223372036854775808
On ppc64
(long)(double)9223372036854775807-1 = 9223372036854775807

NEWS
Zend/zend_operators.h

diff --git a/NEWS b/NEWS
index 2aff180fa9b7cb6cf27a8a3fa6f02154cd0048e3..0649d9d732c6dc864e3a7b2c8559633e808919b1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ PHP                                                                        NEWS
 - CLI server:
   . Fixed bug #64128 (buit-in web server is broken on ppc64). (Remi)
 
+- Core:
+  . Fixed bug #64142 (dval to lval different behavior on ppc64). (Remi)
+
 ?? ??? 2012, PHP 5.4.12
 
 - Core:
index 02a96dd26e264923da78f3ddd6bda6b1db2e0888..93b904f3c94929e4bd90637fa68a86f8ac9fa8f5 100644 (file)
@@ -79,7 +79,7 @@ static zend_always_inline long zend_dval_to_lval(double d)
 #else
 static zend_always_inline long zend_dval_to_lval(double d)
 {
-       if (d > LONG_MAX) {
+       if (d >= LONG_MAX) {
                return (long)(unsigned long) d;
        }
        return (long) d;