php.net |  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
 [2007-03-29 01:04 UTC] aec2105 at columbia dot edu
Description:
------------
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);
print_r($data);
?>

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

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-29 01:06 UTC] aec2105 at columbia dot edu
made summary clearer
 [2008-12-18 21:19 UTC] scottmac@php.net
This appears to be fixed in at least PHP 5.2.8
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 02:01:26 2019 UTC