|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-17 02:04 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 10:00:01 2025 UTC |
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) }