Bug #65616 [Opn]: json_decode now allows single quoted keys
| From: | nikic@php.net | Date: | Wed, 04 Sep 2013 15:58:48 +0000 |
| Subject: | Bug #65616 [Opn]: json_decode now allows single quoted keys | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-181426@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65616&edit=1
ID: 65616
Updated by: nikic@php.net
Reported by: glenjamin at gmail dot com
Summary: json_decode now allows single quoted keys
Status: Open
Type: Bug
Package: JSON related
Operating System: CentOS
PHP Version: 5.5.3
-Assigned To:
+Assigned To: remi
Block user comment: N
Private report: N
New Comment:
Sounds like a json-c bug.
Previous Comments:
------------------------------------------------------------------------
[2013-09-04 15:34:13] glenjamin at gmail dot com
Description:
------------
It appears that json_decode is less strict in newer versions of PHP, and allows object keys to be
single quoted.
Test script:
---------------
$ php -v
PHP 5.5.3 (cli) (built: Aug 21 2013 17:57:15)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
$ php -r "var_dump(json_decode(\"{'a':1}\"));"
class stdClass#1 (1) {
public $a =>
int(1)
}
Expected result:
----------------
json_decode should return NULL and make the error available through json_last_error()
Actual result:
--------------
The string is parsed into an object
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65616&edit=1