Bug #68546 [Opn->Nab]: json_decode() Fatal error: Cannot access property started with '\0'
| From: | requinix@php.net | Date: | Thu, 04 Dec 2014 18:52:24 +0000 |
| Subject: | Bug #68546 [Opn->Nab]: json_decode() Fatal error: Cannot access property started with '\0' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188912@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68546&edit=1
ID: 68546
Updated by: requinix@php.net
Reported by: j dot tvr at centrum dot cz
Summary: json_decode() Fatal error: Cannot access property
started with '\0'
-Status: Open
+Status: Not a bug
Type: Bug
Package: JSON related
PHP Version: 5.6.3
Block user comment: N
Private report: N
New Comment:
*That* code works fine. $obj->{"\x00"} won't, which I assume is what you're
actually trying to report.
If you think your keys may have control characters, or in general characters not valid for
property/variable names, then decode to an array instead. Just because JSON supports certain object
keys doesn't mean PHP should too.
Previous Comments:
------------------------------------------------------------------------
[2014-12-04 16:37:48] j dot tvr at centrum dot cz
Description:
------------
Calling json_decode may result in fatal error.
Test script:
---------------
json_decode('{"\u0000": 1}');
Expected result:
----------------
It should not result in fatal error.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68546&edit=1