Bug #71900 [NEW]: json_decode warns of integer overflow for max int
| From: | david at frankieandshadow dot com | Date: | Fri, 25 Mar 2016 14:55:37 +0000 |
| Subject: | Bug #71900 [NEW]: json_decode warns of integer overflow for max int | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200094@lists.php.net to get a copy of this message | ||
From: david at frankieandshadow dot com
Operating system: Debian Jessie (64 bit)
PHP version: 5.6.19
Package: Unknown/Other Function
Bug Type: Bug
Bug description:json_decode warns of integer overflow for max int
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
--
Edit bug report at https://bugs.php.net/bug.php?id=71900&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71900&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71900&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71900&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71900&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71900&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71900&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71900&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71900&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71900&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71900&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71900&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71900&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71900&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71900&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71900&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71900&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71900&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71900&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71900&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71900&r=mysqlcfg