Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42229 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83508 invoked from network); 13 Dec 2008 03:50:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2008 03:50:27 -0000 Authentication-Results: pb1.pair.com header.from=scott@macvicar.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=scott@macvicar.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain macvicar.net from 193.227.246.108 cause and error) X-PHP-List-Original-Sender: scott@macvicar.net X-Host-Fingerprint: 193.227.246.108 ip246-108-v193.static.x-ip.net Received: from [193.227.246.108] ([193.227.246.108:52001] helo=lovelace.midden.org.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/41-16788-FF033494 for ; Fri, 12 Dec 2008 22:50:25 -0500 Received: from macvicar.demon.co.uk ([80.177.111.173] helo=[192.168.1.100]) by lovelace.midden.org.uk with esmtpsa (TLS-1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1LBLWD-0007sP-F6; Sat, 13 Dec 2008 03:50:20 +0000 Message-ID: <2D85B33E-889B-4214-9BB8-A12EFFFC641E@macvicar.net> To: PHP Developers Mailing List Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Sat, 13 Dec 2008 03:50:11 +0000 Cc: Ilia Alshanetsky X-Mailer: Apple Mail (2.929.2) X-Spam-Score: -4.1 X-Spam_Report: Spam detection software, running on the system "lovelace.midden.org.uk", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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? [...] Content analysis details: (-4.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.8 ALL_TRUSTED Passed through trusted hosts only via SMTP -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] 0.3 AWL AWL: From: address is in the auto white-list Subject: Removing basic types from our JSON parser From: scott@macvicar.net (Scott MacVicar) 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