Bug #68546 [Com]: json_decode() Fatal error: Cannot access property started with '\0'

From: Date: Thu, 04 Dec 2014 22:57:16 +0000
Subject: Bug #68546 [Com]: json_decode() Fatal error: Cannot access property started with '\0'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188915@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 Comment by: j dot tvr at centrum dot cz Reported by: j dot tvr at centrum dot cz Summary: json_decode() Fatal error: Cannot access property started with '\0' 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 does NOT work fine, it is a bug in ext-json. Both jsonc (http://pecl.php.net/package/jsonc) and jsond (http://pecl.php.net/package/jsond) do not result in fatal error for the very same input. Previous Comments: ------------------------------------------------------------------------ [2014-12-04 18:52:23] requinix@php.net *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. ------------------------------------------------------------------------ [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

« previous php.bugs (#188915) next »