Removing basic types from our JSON parser

From: Date: Sat, 13 Dec 2008 03:50:11 +0000
Subject: Removing basic types from our JSON parser
Groups: php.internals 
Request: Send a blank email to internals+get-42229@lists.php.net to get a copy of this message
Hi All, Basic types were added to our JSON decoder to PHP 5.2.1, this allows one to use json_encode / json_decode on any of our scalar types. Omar correctly identified #38680 as not a bug but it appears that Ilia added support for this anyway violating the RFC [1]. Maybe there was a reason for this but I'm not sure why? The problem here is that none of the other JSON parsers in any other language support this and more importantly the browsers [2] which are now adding native JSON support. Users are frequently expecting the result from a json_encode in PHP to just work with JSON.parse() on the client side. [3] I have a patch for this that implements the RFC exactly and makes secure json_encode only works with objects and arrays. This would be a change for 5.3+ and we should just document in 5.2 that what we did was a bad idea. Scott [1] - http://www.ietf.org/rfc/rfc4627.txt?number=4627 [2] - http://wiki.ecmascript.org/doku.php?id=es3.1:json_support [3] - https://developer.mozilla.org/en/Using_JSON_in_Firefox

« previous php.internals (#42229) next »