Edit report at https://bugs.php.net/bug.php?id=69763&edit=1
ID: 69763 Updated by: [email protected] Reported by: bruno at skvorc dot me Summary: Json-c is *not* a drop-in replacement Status: Open Type: Bug -Package: json +Package: PECL Operating System: All PHP Version: 5.6.9 Block user comment: N Private report: N New Comment: Actually, the package should be "jsonc", but unfortunately that is not available from the list, so I've changed to "PECL". Anyhow, it seems that JSON_BIGINT_AS_STRING is not (yet) fully implemented: <https://github.com/remicollet/pecl-json-c/commit/5822493892c65219db07378f22bb3b1ccb5fdd06>. Previous Comments: ------------------------------------------------------------------------ [2015-06-06 09:51:15] bruno at skvorc dot me Description: ------------ --- >From manual page: http://www.php.net/function.json-decode --- In example #5, BIGINT is converted to string using the JSON_BIGINT_AS_STRING flag. However, when using Remi's pecl extension (the drop in replacement), this will fail and report an integer overflow notice for numbers larger than signed max integer (like the one in the json_decode documents). Obviously, this is an edge case, but it still *can* and *does* affect some implementations - the API of the company I'm building a lib for sometimes returns unsigned 64bit integers, and thus this will break. Since we're dealing with JSON, the notice headers will break things and make my app unusable unless I use the silence operator(@). More details here: http://stackoverflow.com/questions/30680565/json-decode-and-php-json-bigint-as-string-disparity Test script: --------------- <?php var_dump(json_decode('{"number": 12345678901234567890}', false, 512, JSON_BIGINT_AS_STRING)); Expected result: ---------------- object(stdClass)#1 (1) { ["number"]=> string(20) "12345678901234567890" } Actual result: -------------- https://www.dropbox.com/s/dqquq13pjymeyrt/Screenshot%202015-06-06%2011.48.33.png?dl=0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69763&edit=1 -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
