Edit report at https://bugs.php.net/bug.php?id=65304&edit=1

 ID:                 65304
 Comment by:         thuhc at yahoo dot com
 Reported by:        koushky at gmail dot com
 Summary:            Use of max int in array_sum
 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:

This bug still happen on ARM 64bits (aarch64)

================================================================================
/root/php-5.5.4/ext/standard/tests/array/bug65304.phpt
================================================================================
int(-9223372036854775808)
float(9.2233720368548E+18)
================================================================================
001+ int(-9223372036854775808)
002- float(%s)
================================================================================


Previous Comments:
------------------------------------------------------------------------
[2013-07-21 13:07:45] larue...@php.net

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)

------------------------------------------------------------------------
[2013-07-21 12:12:03] larue...@php.net

use fast_add_function here fixed the in-consistent.

------------------------------------------------------------------------
[2013-07-21 12:11:25] larue...@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

Reply via email to