Req #67592 [NEW]: Encode with JSON_BIGINT_AS_STRING doesn't add quotes on bigints on 64bit machin

From: Date: Tue, 08 Jul 2014 15:14:10 +0000
Subject: Req #67592 [NEW]: Encode with JSON_BIGINT_AS_STRING doesn't add quotes on bigints on 64bit machin
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186530@lists.php.net to get a copy of this message
From:             ryangrahamnc at gmail dot com
Operating system: Ubuntu 12.04 LTS 64bit
PHP version:      5.5.14
Package:          JSON related
Bug Type:         Feature/Change Request
Bug description:Encode with JSON_BIGINT_AS_STRING doesn't add quotes on bigints on 64bit machin

Description:
------------
Normally JSON_BIGINT_AS_STRING is only used on decodes, but I think it's
useful in encode as well. i.e. for sending json to a javascript client,
which would convert bigints to floats unless the quotes were added.

Test script:
---------------
var_dump(json_encode(['a'=>974110684307885632], JSON_BIGINT_AS_STRING));

Expected result:
----------------
string(26) "{"a":"974110684307885632"}"

Actual result:
--------------
string(24) "{"a":974110684307885632}"

-- 
Edit bug report at https://bugs.php.net/bug.php?id=67592&edit=1
-- 



Thread (2 messages)

« previous php.bugs (#186530) next »