|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68231 Unexpected identifier in the json_decode
Submitted: 2014-10-15 09:38 UTC Modified: 2014-10-15 16:56 UTC
From: armin390 at gmail dot com Assigned:
Status: Not a bug Package: JSON related
PHP Version: 5.6.1 OS: Debian sid
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
43 - 23 = ?
Subscribe to this entry?

 [2014-10-15 09:38 UTC] armin390 at gmail dot com
When I try to decode a json string that include a key with identifiers,then it will be converted to an invalid propery name.

Test script:
$string = '{"test-me+for": "X"}';

Expected result:
Fatal error: syntax error, unexpected ...

Actual result:
object(stdClass)#1 (1) { ["test-me+for"]=> string(1) "X" }


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-15 16:56 UTC]
-Status: Open +Status: Not a bug
 [2014-10-15 16:56 UTC]
"test-me+for" is a valid property name in PHP. You can access it using $obj->{"test-me+for"}.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 28 23:01:28 2024 UTC