php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71900 json_decode warns of integer overflow for max int
Submitted: 2016-03-25 14:55 UTC Modified: 2016-04-03 04:22 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: david at frankieandshadow dot com Assigned:
Status: No Feedback Package: Unknown/Other Function
PHP Version: 5.6.19 OS: Debian Jessie (64 bit)
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: david at frankieandshadow dot com
New email:
PHP Version: OS:

 

 [2016-03-25 14:55 UTC] david at frankieandshadow dot com
Description:
------------
This is actually version 5.6.17, it is not practical for me to upgrade currently. 5.6.17 is the most up to date Debian Jessie distribution.

The json_decode function produces 
   PHP Notice:  json_decode(): integer overflow detected in .../test.php on line 11
when the value concerned is 9223372036854775807 (i.e. PHP_INT_MAX), which is a valid value.

This has a particular impact in decoding certain results from elasticsearch which contain max int values.

Test script:
---------------
<?php

echo PHP_INT_MAX, "\n";

$a = array('a' => PHP_INT_MAX); /* it works OK if you put PHP_INT_MAX-1 here */
print_r($a);
$j = json_encode($a);

echo $j, "\n";

$b = json_decode($j); /* produces the incorrect error message */
print_r($b);


Expected result:
----------------
No warning.


Actual result:
--------------
PHP Notice:  json_decode(): integer overflow detected

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-25 17:45 UTC] danack@php.net
-Status: Open +Status: Feedback
 [2016-03-25 17:45 UTC] danack@php.net
Hello,

I am am unable to reproduce this error on any version of PHP that was released by the PHP team. https://3v4l.org/AasT7

I think you need to open a ticket with the Debian maintainers of PHP. They replaced the json extension that PHP ships with, with one that had a different license.
 [2016-03-26 12:17 UTC] david at frankieandshadow dot com
Thank you. Reported to Debian as

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819304
 [2016-04-03 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 08:01:30 2024 UTC