Bug #71900 [Opn->Fbk]: json_decode warns of integer overflow for max int

From: Date: Fri, 25 Mar 2016 17:45:20 +0000
Subject: Bug #71900 [Opn->Fbk]: json_decode warns of integer overflow for max int
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200096@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71900&edit=1 ID: 71900 Updated by: danack@php.net Reported by: david at frankieandshadow dot com Summary: json_decode warns of integer overflow for max int -Status: Open +Status: Feedback Type: Bug Package: Unknown/Other Function Operating System: Debian Jessie (64 bit) PHP Version: 5.6.19 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2016-03-25 14:55:24] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71900&edit=1

« previous php.bugs (#200096) next »