ID: 46600
Comment by: matt at mpcm dot com
Reported By: Matt at mpcm dot com
Status: Verified
Bug Type: JSON related
Operating System: *
PHP Version: 5CVS, 6CVS (2008-11-18)
New Comment:
All the work arounds I am looking at are throwing Error Text: Illegal
member variable name when I convert/cast an object with a blank
property.
Is this json_decode `bug` a result of a larger object mechanism
limitation inside of php's object handling?
Previous Comments:
------------------------------------------------------------------------
[2008-11-18 03:13:51] Matt at mpcm dot com
Description:
------------
json_decode() treats empty property name as "_empty_" not "". This was
fixed in #41504 for arrays, but not for objects. (seems to happen in PHP
Version 5.2.4-2ubuntu5.3 and 5.3.0alpha2.
Reproduce code:
---------------
<?
$s = '{"":"test"}';
var_dump(json_decode($s));
?>
Expected result:
----------------
object(stdClass)#1 (1) { [""]=> string(4) "test" }
Actual result:
--------------
object(stdClass)#2 (1) { ["_empty_"]=> string(4) "test" }
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46600&edit=1