Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42286 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19820 invoked from network); 16 Dec 2008 12:21:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2008 12:21:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=troelskn@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=troelskn@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.221.20 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: troelskn@gmail.com X-Host-Fingerprint: 209.85.221.20 mail-qy0-f20.google.com Received: from [209.85.221.20] ([209.85.221.20:35816] helo=mail-qy0-f20.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/FD-30437-B2D97494 for ; Tue, 16 Dec 2008 07:21:00 -0500 Received: by qyk13 with SMTP id 13so2948427qyk.23 for ; Tue, 16 Dec 2008 04:20:57 -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=oEHhpjrNZYWWZle9gD2ME4kWy9JdVs8rIFmW/hzTT/M=; b=kGZH0OHMcp+vQ8mSk//GtFs8RhIOfssOx9NCTDI1gmcpFcQbnX5nAuT9zKTPB5DaHe CNBF9w+pZM6HIAlmwcmHhACrxIT0kcEvISgMckHbkSZYTF8DfysXnMzQGpXdZfSDTbPA /IB8fW2MG+TwlgGqNHXxix6rv5r39JnWwt3mE= 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=BciCzalwF/O9HLU5RrkMY+SLGtjvbzzMGHFuCo42oKCjuIfIfmd8GMoRKqpWYRG6xs y7lrRwDUeZHCmw0EaQG1YR09X75SDayM2a4I7rSjy9KM0m9nEYkRLOKVvMCDwkCbXCsB AWl6Pol1GzChBbHLSj0snhimtK+5CLfad1XJA= Received: by 10.215.39.14 with SMTP id r14mr9182971qaj.80.1229430057368; Tue, 16 Dec 2008 04:20:57 -0800 (PST) Received: by 10.214.79.7 with HTTP; Tue, 16 Dec 2008 04:20:57 -0800 (PST) Message-ID: <98b8086f0812160420u12a92ac5v2c202ef679b542e0@mail.gmail.com> Date: Tue, 16 Dec 2008 13:20:57 +0100 To: "Scott MacVicar" Cc: "PHP Developers Mailing List" In-Reply-To: <494797BE.3060505@macvicar.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <494698D3.2030801@lerdorf.com> <10845a340812160348k18bffb0et1e75cf345b5e42cc@mail.gmail.com> <494797BE.3060505@macvicar.net> Subject: Re: [PHP-DEV] json_encode() From: troelskn@gmail.com ("troels knak-nielsen") 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. -- troels