Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42288 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21495 invoked from network); 16 Dec 2008 12:23:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2008 12:23:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.46.29 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 74.125.46.29 yw-out-2324.google.com Received: from [74.125.46.29] ([74.125.46.29:16810] helo=yw-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/4E-30437-DCD97494 for ; Tue, 16 Dec 2008 07:23:41 -0500 Received: by yw-out-2324.google.com with SMTP id 5so1345829ywb.83 for ; Tue, 16 Dec 2008 04:23:38 -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=2xtJgCcZ7WuzkAXcpkF51x0ovjxnnbQdtJb1qOxA0Sg=; b=ivuR6ll65KjknWCfzFqHJvMmIFYaHlm36ASp9SSpP7Tf5PrN+OOIFy+B7pj6jI+APP SQ9JzJw259sCGi9k7byuYlJ7FsR0m/1/+u+UBMwZr2UuCKjI5EEXuPylKPpKVgNDBalE U+yLpmRr+cFlff80+mdt03OXe9wOqgEnaTgpI= 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=EInutnLCDa/0iHvirh9pTIg+nBHIIOs1sg3AEIN5tCvcIK4WbWQ6Pmx7ZQvtEmq6T+ DlHR+BAPknPBOE4YD43CJorsjEUDim4M73BC4MYJSh40y8IfXaWEYGTqjn/sJE8nvdmY Kk2FscWCUtIH8CSi7hprYuAWAbvBHJLy+JmGU= Received: by 10.100.172.17 with SMTP id u17mr5398580ane.105.1229430217543; Tue, 16 Dec 2008 04:23:37 -0800 (PST) Received: by 10.100.93.10 with HTTP; Tue, 16 Dec 2008 04:23:37 -0800 (PST) Message-ID: Date: Tue, 16 Dec 2008 15:23:37 +0300 To: "troels knak-nielsen" Cc: "Scott MacVicar" , "PHP Developers Mailing List" In-Reply-To: <98b8086f0812160420u12a92ac5v2c202ef679b542e0@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <494698D3.2030801@lerdorf.com> <10845a340812160348k18bffb0et1e75cf345b5e42cc@mail.gmail.com> <494797BE.3060505@macvicar.net> <98b8086f0812160420u12a92ac5v2c202ef679b542e0@mail.gmail.com> Subject: Re: [PHP-DEV] json_encode() From: indeyets@gmail.com ("Alexey Zakhlestin") On Tue, Dec 16, 2008 at 3:20 PM, troels knak-nielsen wrote: > On Tue, Dec 16, 2008 at 12:57 PM, Scott MacVicar wrote: >> For now I'll be leaving it as is and adding a JSON_STRICT_ENCODE >> parameter to the options flag. So you can use >> >> json_encode($var, JSON_STRICT_ENCODE); >> > > I'm really not a fan of named constants to change the semantics of a > function like that. Not to mention that it's a pita to type out, so > nobody would bother. It also doesn't address the crux of the matter - > That the name json_encode is slightly misleading, in that it may or > may not emit json. > > Would it be a problem to introduce a second function (js_encode?) > instead? It could work as json_encode does today, and json_encode > could then be changed to raise a warning on illegal input. I realise > that this means breaking existing scripts, but it's a trivial change, > and if it's announced in advance, people should have time to make that > sed -r '/json_encode/js_encode/g' to their code base. sounds like a proper way to me -- Alexey Zakhlestin http://www.milkfarmsoft.com/