php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63737 json_decode does not properly decode with options parameter
Submitted: 2012-12-11 11:03 UTC Modified: 2013-01-08 03:59 UTC
From: googleguy@php.net Assigned: aharvey (profile)
Status: Closed Package: JSON related
PHP Version: 5.4.9 OS:
Private report: No CVE-ID: None
 [2012-12-11 11:03 UTC] googleguy@php.net
Description:
------------
json_decode does not properly decode JSON strings using options parameter.



Test script:
---------------
json_decode('12345678901234567890', false, 512, JSON_BIGINT_AS_STRING); // this won't work

However this will

json_decode('[12345678901234567890]', false, 512, JSON_BIGINT_AS_STRING);

Expected result:
----------------
string(20) "12345678901234567890"

Actual result:
--------------
float(1.2345678901235E+19)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-11 11:04 UTC] aharvey@php.net
Our code path for bare integer literals is different to the one we use for literals within objects and arrays. Should be an easy fix.
 [2012-12-11 11:04 UTC] aharvey@php.net
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: aharvey
 [2012-12-11 12:04 UTC] aharvey@php.net
-Status: Analyzed +Status: Closed
 [2012-12-11 12:04 UTC] aharvey@php.net
The fix for this bug has been committed.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Fixed on 5.4, 5.5 and master.
 [2013-01-02 11:46 UTC] franssen dot roland at gmail dot com
This is still an issue in 5.4.10 (Linux)
 [2013-01-02 20:13 UTC] googleguy@php.net
-Status: Closed +Status: Re-Opened
 [2013-01-02 20:18 UTC] googleguy@php.net
This commit has been removed from the release branch for some reason.
 [2013-01-08 03:59 UTC] aharvey@php.net
It was never on the release branch: I committed it after 5.4.10 was branched. It'll be in 5.4.11.
 [2013-01-08 03:59 UTC] aharvey@php.net
-Status: Re-Opened +Status: Closed
 [2013-01-08 03:59 UTC] aharvey@php.net
It was never on the release branch: I committed it after 5.4.10 was branched. It'll be in 5.4.11.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC