Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42252 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6358 invoked from network); 14 Dec 2008 09:40:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Dec 2008 09:40:55 -0000 Authentication-Results: pb1.pair.com header.from=thetaphi@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=thetaphi@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 80.190.230.99 as permitted sender) X-PHP-List-Original-Sender: thetaphi@php.net X-Host-Fingerprint: 80.190.230.99 www.troja.net Linux 2.5 (sometimes 2.4) (4) Received: from [80.190.230.99] ([80.190.230.99:54754] helo=mail.troja.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/E6-47862-6A4D4494 for ; Sun, 14 Dec 2008 04:40:55 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.troja.net (Postfix) with ESMTP id 578F84E229; Sun, 14 Dec 2008 10:40:52 +0100 (CET) Received: from mail.troja.net ([127.0.0.1]) by localhost (cyca.troja.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09113-06; Sun, 14 Dec 2008 10:40:50 +0100 (CET) Received: from VEGA (port-83-236-62-11.dynamic.qsc.de [83.236.62.11]) (using SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.troja.net (Postfix) with ESMTP id 3BBDF4E15D; Sun, 14 Dec 2008 10:40:50 +0100 (CET) To: "'Rasmus Lerdorf'" , "'mike'" Cc: "'moo.tinys'" , "'Stan Vassilev | FM'" , "'PHP Developers Mailing List'" References: <2D85B33E-889B-4214-9BB8-A12EFFFC641E@macvicar.net> <1229150500.30719.201.camel@localhost> <4BA26FE8A9634178B4CEBEFA818810D2@VEGA> <15E310EAB433466EAF996B252CBED2BB@pc> <49448D66.2030501@lerdorf.com> <28139bc0812132210p1ed94f4ds40e31ff499cf2e7@mail.gmail.com> <7463F1E1-A880-479F-9584-30FFCED6E614@gmail.com> <4944AA37.9030400@lerdorf.com> <234C8048-A00D-4AEE-A23E-5FA10EA85D6D@gmail.com> <4944AD36.7070406@lerdorf.com> <6C9F85B0-29B8-419C-8DD1-BA90135214D3@gmail.com> <4944C651.1090801@lerdorf.com> Date: Sun, 14 Dec 2008 10:40:49 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <4944C651.1090801@lerdorf.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: Acldx5Znd+AqwY77TeauByv6CmbGxwAB8asg Subject: RE: [PHP-DEV] Removing basic types from our JSON parser From: thetaphi@php.net ("Uwe Schindler") > > > will always work. The only question is what sort of variable foo will > end up being. The RFC says we have to wrap basic types in an array or > object, while currently we let the basic types through without the > wrapper. He problem her eis: A lot of people use in a way and assume, that a basic type is serialized as a basic type in JSON/JS. If we change this, it could break a lot of apps. And the above is really nice to encode PHP strings to a secure JS variant. It is hard to do with addslashes etc. So I think, we should not change the way it works currently. I think in the docs for json_encode() should be a warning: "JSON officially only supports Objects and Arrays as outer/top-level/... type for JSON serializations. So the argument of json_encode must be a PHP object or array to be fully JSON conformant. If you provide a simple type (string, number, Boolean), json_encode will generate a valid java script, but some conformant JSON parser may not be able to read it." How about this? Uwe