From: Operating system: FreeBSD PHP version: 5.3.8 Package: JSON related Bug Type: Bug Bug description:JSON_NUMERIC_CHECK option mangles certain values
Description:
------------
json_encode will produce undesired results when used with
JSON_NUMERIC_CHECK when one or more values is longer than 12 digits, ex:
3434343434343434. The resulting JSON encoded string has the above value
listed as: 3434343434340000.
Removing the JSON_NUMERIC_CHECK option fixes the problem, but then all
other numeric values are returned as strings rather than integers.
Test script:
---------------
$test = array("test"=>3434343434343434);
$test = json_encode($test, JSON_NUMERIC_CHECK);
echo $test;
Expected result:
----------------
{"test":3434343434343434}
OR
{"test":"3434343434343434"}
Actual result:
--------------
{"test":3434343434340000}
--
Edit bug report at https://bugs.php.net/bug.php?id=60111&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60111&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60111&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60111&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60111&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60111&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60111&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60111&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60111&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60111&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60111&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60111&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60111&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60111&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60111&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60111&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60111&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60111&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60111&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60111&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60111&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60111&r=mysqlcfg
