|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57597 json_decode of large positive int results in negative int
Submitted: 2007-03-29 01:04 UTC Modified: 2008-12-18 21:19 UTC
From: aec2105 at columbia dot edu Assigned:
Status: Closed Package: json (PECL)
PHP Version: 5.2.1 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: aec2105 at columbia dot edu
New email:
PHP Version: OS:


 [2007-03-29 01:04 UTC] aec2105 at columbia dot edu
json_decode on a large int causes incorrect parse. In the instance below, json_decode produces a negative int.

*Note putting quotation marks around the int resolves the issue... although this should not be necessary.

Reproduce code:
$string='{"test_int": 102000000000008277}';
$data = json_decode($string,true);

Expected result:
Array ( [test_int] => 102000000000008277 )

Actual result:
Array ( [test_int] => -1491656619 ) 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-29 01:06 UTC] aec2105 at columbia dot edu
made summary clearer
 [2008-12-18 21:19 UTC]
This appears to be fixed in at least PHP 5.2.8
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Sep 27 02:05:53 2022 UTC