|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57468 decode choking on js comments
Submitted: 2007-01-05 08:34 UTC Modified: 2008-12-18 21:31 UTC
From: jan at horde dot org Assigned:
Status: Not a bug Package: json (PECL)
PHP Version: Irrelevant OS:
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:
41 - 4 = ?
Subscribe to this entry?

 [2007-01-05 08:34 UTC] jan at horde dot org
json_decode() doesn't decode json data that contains comments.

Reproduce code:
var_dump(json_decode("{ /* comment inside */ }"));

Expected result:
object(stdClass)(0) {

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-18 21:31 UTC]
Comments are not valid JSON data, JSON doesn't support all of 
the JavaScript tokens.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 26 22:03:33 2021 UTC