|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-25 16:00 UTC] mattwil@php.net
[2009-10-25 16:05 UTC] warren at guy dot net dot au
[2009-10-25 20:19 UTC] jani@php.net
[2009-10-25 22:55 UTC] shupp@php.net
[2009-10-26 00:07 UTC] warren at guy dot net dot au
[2009-10-26 00:09 UTC] warren at guy dot net dot au
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 22:00:01 2025 UTC |
Description: ------------ json_decode truncates numbers greater than 32 bit int 2147483647 on 32 bit system Reproduce code: --------------- <? $json_encoded = '{"test_id_small_int":12345,"test_id_maxint":2147483647,"test_id_maxint_plus_two":2147483649,"test_id_huge_int":80000000000}'; var_dump(json_decode($json_encoded)); ?> Expected result: ---------------- object(stdClass)#1 (4) { ["test_id_small_int"]=> int(12345) ["test_id_maxint"]=> int(2147483647) ["test_id_maxint_plus_two"]=> float(2147483649) ["test_id_huge_int"]=> float(80000000000) } or even strings instead of floats would work for me. Actual result: -------------- object(stdClass)#1 (4) { ["test_id_small_int"]=> int(12345) ["test_id_maxint"]=> int(2147483647) ["test_id_maxint_plus_two"]=> int(2147483647) ["test_id_huge_int"]=> int(2147483647) }