php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46730 json_decode and 32Bit Maschines
Submitted: 2008-12-02 12:53 UTC Modified: 2008-12-02 14:35 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: info at marcel-schlesinger dot de Assigned:
Status: Not a bug Package: JSON related
PHP Version: 5.2.6 OS: ALL
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: info at marcel-schlesinger dot de
New email:
PHP Version: OS:

 

 [2008-12-02 12:53 UTC] info at marcel-schlesinger dot de
Description:
------------
Using json_decode with numbers higher then 2147483647 on a 32Bit maschine is still wrong! E.g. 5095334700020 has to be converted into a float (a string would be also okay), but not into an integer!

Reproduce code:
---------------
<?php
   $json = '{"number":5095334700020}';
   var_dump(json_decode($json));
?>

Expected result:
----------------
object(stdClass)#1 (1) {
  ["number"]=>
  float(5095334700020)
}

it could also be:

object(stdClass)#1 (1) {
  ["number"]=>
  string(13) "5095334700020"
}

Actual result:
--------------
object(stdClass)#1 (1) {
  ["number"]=>
  int(2147483647)
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-02 13:01 UTC] info at marcel-schlesinger dot de
Updated category
 [2008-12-02 14:35 UTC] mattwil@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

Can't reproduce -- should be fixed since 5.2.4... Feel free to reopen if you're actually using 5.2.6 and seeing this. :-)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 09 03:01:28 2024 UTC