From:             glenjamin at gmail dot com
Operating system: CentOS
PHP version:      5.5.3
Package:          JSON related
Bug Type:         Bug
Bug description:json_decode now allows single quoted keys

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 bug report at https://bugs.php.net/bug.php?id=65616&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65616&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65616&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65616&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65616&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65616&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65616&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65616&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65616&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65616&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65616&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65616&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65616&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65616&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65616&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65616&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65616&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65616&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65616&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65616&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65616&r=mysqlcfg

Reply via email to