Bug #65304 [Opn->Csd]: Use of max int in array_sum
| From: | laruence@php.net | Date: | Sun, 21 Jul 2013 13:07:45 +0000 |
| Subject: | Bug #65304 [Opn->Csd]: Use of max int in array_sum | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-180385@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65304&edit=1
ID: 65304
Updated by: laruence@php.net
Reported by: koushky at gmail dot com
Summary: Use of max int in array_sum
-Status: Open
+Status: Closed
Type: Bug
Package: Arrays related
Operating System: Ubuntu 13.04 64bit
PHP Version: 5.4.17
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3380de9774551964af976aa48328e7e6f9bd78ff
Log: Fixed bug #65304 (Use of max int in array_sum)
Previous Comments:
------------------------------------------------------------------------
[2013-07-21 12:12:03] laruence@php.net
use fast_add_function here fixed the in-consistent.
------------------------------------------------------------------------
[2013-07-21 12:11:25] laruence@php.net
The following patch has been added/updated:
Patch Name: bug65304.patch
Revision: 1374408685
URL: https://bugs.php.net/patch-display.php?bug=65304&patch=bug65304.patch&revision=1374408685
------------------------------------------------------------------------
[2013-07-21 09:47:33] koushky at gmail dot com
update
------------------------------------------------------------------------
[2013-07-21 09:37:52] koushky at gmail dot com
Description:
------------
If we add amount of max INT with number 1 in array_sum function , the result will
be false.
While if we add this two via plus (+) operator ,the result will be true.
My operation system is 64 bit.
Test script:
---------------
/* max INT in 64bit = 9223372036854775807 */
var_dump(array_sum(array(9223372036854775807,1)));
var_dump(9223372036854775807+1);
Expected result:
----------------
int(-9223372036854775808)
float(9.2233720368548E+18)
Actual result:
--------------
float(9.2233720368548E+18)
float(9.2233720368548E+18)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65304&edit=1