Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42289 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24748 invoked from network); 16 Dec 2008 12:31:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2008 12:31:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=ionut.g.stan@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ionut.g.stan@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.154 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ionut.g.stan@gmail.com X-Host-Fingerprint: 72.14.220.154 fg-out-1718.google.com Received: from [72.14.220.154] ([72.14.220.154:62238] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/0F-30437-F9F97494 for ; Tue, 16 Dec 2008 07:31:27 -0500 Received: by fg-out-1718.google.com with SMTP id 16so1379357fgg.23 for ; Tue, 16 Dec 2008 04:31:25 -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 :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=649ghA+uMQYTGjxiCP9+NApOf0/3JEdNKthJDp6t0l4=; b=fL7W7nJdkYA2Ig+4zQGPgw03767FI5wpFCN/CZS8V8909KLM0jKPZpD92YEJoKlcqb 09SMZVNGVpT1ZIyLBaicEGFj5MnOpcZ5j/buLjn688Xb0DyFTVNQLbaBJ6ZCQxau1ZZA 94EfG4ALW2YmLAZ6BMf/Iodo5BIldXBV5YUS0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=fejOeNuPabweoPShAsQt8FY9dMY17ooNc5QVOyUFP5ZNPYrKe0dvyayVN2e/DDQ2Rb X3r+5zRHoKstB0Knh71GI7Choym2IVjq4JnILGS9hYjWo1amSQkjf0uAfrcCwwfwrtbW zlTm/PRCoF/3gFUJLlfNc5eKazmg8g1xI2RKw= Received: by 10.86.84.5 with SMTP id h5mr4532402fgb.12.1229430684758; Tue, 16 Dec 2008 04:31:24 -0800 (PST) Received: from ?10.0.0.187? (mail.cmbtravel.ro [84.234.105.22]) by mx.google.com with ESMTPS id 4sm1756664fgg.27.2008.12.16.04.31.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 16 Dec 2008 04:31:23 -0800 (PST) Message-ID: <49479F27.4020200@gmail.com> Date: Tue, 16 Dec 2008 14:29:27 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/20081204 Thunderbird/3.0b1 MIME-Version: 1.0 To: PHP Developers Mailing List References: <494698D3.2030801@lerdorf.com> <10845a340812160348k18bffb0et1e75cf345b5e42cc@mail.gmail.com> <494797BE.3060505@macvicar.net> <98b8086f0812160420u12a92ac5v2c202ef679b542e0@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] json_encode() From: ionut.g.stan@gmail.com (Ionut Gabriel Stan) On 12/16/2008 14:23, Alexey Zakhlestin wrote: > 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 > Me too, but I rather name the function js_escape instead of js_encode.