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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: aec2105 at columbia dot edu
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC