[Pkg-php-pecl] Bug#819304: json_decode warns of integer overflow for max int

David Earl david at frankieandshadow.com
Sat Mar 26 11:27:36 UTC 2016


Package: php5-json
Version: 1.3.6

(This is from an up-to-date Debian Jessie 63 bit install, using PHP 5.6.17,
package version as reported by phpinfo())

I reported this bug to PHP. They said it was a replacement component in
Debian's PHP.
  https://bugs.php.net/bug.php?id=71900

Description:
------------

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-php-pecl/attachments/20160326/24ce264c/attachment.html>


More information about the Pkg-php-pecl mailing list