ID: 47644 Updated by: scott...@php.net Reported By: asari at users dot sourceforge dot net -Status: Verified +Status: Closed Bug Type: JSON related Operating System: * (64bit) PHP Version: 5.*, 6CVS (2009-03-15) New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2009-03-13 13:25:57] asari at users dot sourceforge dot net Description: ------------ In some cases, json_decode() fails to decode large integer (over 10000000000000000) inside an array, e.g. "[10000000000000001]". $ uname -a Linux _HOSTNAME_.localdomain 2.6.18-53.1.21.el5 #1 SMP Tue May 20 09:35:07 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux $ lsb_release -a LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: CentOS Description: CentOS release 5.2 (Final) Release: 5.2 Codename: Final $ ./sapi/cli/php --version PHP 5.3.0beta2-dev (cli) (built: Mar 13 2009 21:55:38) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies $ cat config.nice #! /bin/sh # # Created by configure './configure' \ '--prefix=/tmp/php53' \ "$@" Reproduce code: --------------- $ for ((i=10000000000000000; i<10000000000000006; i++)); do echo $i; ./sapi/cli/php -r 'var_dump(json_decode("['$i']"));'; echo; done Expected result: ---------------- 10000000000000000 array(1) { [0]=> int(10000000000000000) } 10000000000000001 array(1) { [0]=> int(10000000000000001) } 10000000000000002 array(1) { [0]=> int(10000000000000002) } 10000000000000003 array(1) { [0]=> int(10000000000000003) } 10000000000000004 array(1) { [0]=> int(10000000000000004) } 10000000000000005 array(1) { [0]=> int(10000000000000005) } Actual result: -------------- 10000000000000000 array(1) { [0]=> int(10000000000000000) } 10000000000000001 array(1) { [0]=> int(10000000000000000) } 10000000000000002 array(1) { [0]=> int(10000000000000002) } 10000000000000003 array(1) { [0]=> int(10000000000000004) } 10000000000000004 array(1) { [0]=> int(10000000000000004) } 10000000000000005 array(1) { [0]=> int(10000000000000004) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47644&edit=1