Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42271 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98210 invoked from network); 15 Dec 2008 21:02:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Dec 2008 21:02:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=mike503@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mike503@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.198.237 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: mike503@gmail.com X-Host-Fingerprint: 209.85.198.237 rv-out-0506.google.com Received: from [209.85.198.237] ([209.85.198.237:10752] helo=rv-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/21-24547-7E5C6494 for ; Mon, 15 Dec 2008 16:02:32 -0500 Received: by rv-out-0506.google.com with SMTP id g37so2905181rvb.23 for ; Mon, 15 Dec 2008 13:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=xiKqm2Mq6QpOi8rucGmpnYn7DlgD3gypsxPdUXrGHIw=; b=QT4mp7WiTzBgN7u6KljHh+GVObFnhRy1rfHXkAU4gYq5iEAtI5YXry1o65UD/by9pX 7+zeFM6fqU05vvQHo74NTeWNUGbM6U6Oo+iuqS73tKqM8cUZ3pHkztECyOBset4uW7S8 NVIZZLndKk0G9eV8ZPVAn4iOwFpx99oRARmEk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=ArnbqxbeNP4JHjgqvfGWf3Azy3gXncAgLCzo+0/hLhdpA3Kn0RiquPqAWKWto4KuZH +YbRWg9c/M78RjZHBdapltem93qW2K4fQ6E8HbMmfW9SEOxZyyfmYX2E/hcQDLe48uw9 ZuQ4Vrp0fO1qlH36/cAntFrYVcXz8q9kbeyd8= Received: by 10.140.193.16 with SMTP id q16mr3933537rvf.6.1229374949218; Mon, 15 Dec 2008 13:02:29 -0800 (PST) Received: by 10.141.152.1 with HTTP; Mon, 15 Dec 2008 13:02:29 -0800 (PST) Message-ID: Date: Mon, 15 Dec 2008 13:02:29 -0800 To: "Uwe Schindler" Cc: "PHP Developers Mailing List" In-Reply-To: <7977336F527D4A70B0E4DD2870708686@VEGA> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <494698D3.2030801@lerdorf.com> <7977336F527D4A70B0E4DD2870708686@VEGA> Subject: Re: [PHP-DEV] json_encode() From: mike503@gmail.com (mike) On Mon, Dec 15, 2008 at 12:55 PM, Uwe Schindler wrote: > As is noted in an earlier mail, I would prefer 1 (simply document it in the > function description). In my opinion, if somebody then passes a basic type > to json_encode he is aware of what he is doing (hopefully). > > For compatibility with current code and securely escaping strings for > javascript it is the best. PHP 6 will require some recoding for various things. I'd like to see it "do the right thing" in PHP 6, and perhaps if people are using json_encode for escaping, make another function that is there purely for escaping javascript, not serializing/unserializing it for direct exchange with JSON consumption in javascript. After all, this is json_encode, not javascript_escape ... I was unaware that json_encode() [improperly] encoded non-arrays/objects, as I expected those details to be worked out in the implementation. While it does produce legitimate javascript it does not produce legitimate JSON, which is the purpose of these functions, no?