|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-11-10 16:42 UTC] pwinnski at gmail dot com
Description: ------------ In 5.2.14, json_encode() silently discards any array values for which the array key is an empty string. This seems identical to Bug #41505, but affects PHP 5.2.14. Demonstration code: var_dump(json_encode(array("" => array("a" => 1)))); Expect (result in 5.2.6, 5.2.10, 5.2.13, 5.3.2): string(12) "{"":{"a":1}}" Receive (in 5.2.14): string(2) "{}" Test script: --------------- var_dump(json_encode(array("" => array("a" => 1)))); Expected result: ---------------- string(12) "{"":{"a":1}}" Actual result: -------------- string(2) "{}" PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 20:00:01 2025 UTC |
I can't reproduce this in PHP 5.2.14: root@router:~# php -v PHP 5.2.14 (cli) (built: Aug 18 2010 17:16:15) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies root@router:~# php <?php dl("json.so"); var_dump(json_encode(array("" => array("a" => 1)))); string(12) "{"":{"a":1}}" But even if there was actually a bug, PHP 5.2 is only to receive security updates at this point. So Bogus/Wont Fix.