Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42279 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62435 invoked from network); 16 Dec 2008 06:34:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2008 06:34:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 69.16.228.148 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 69.16.228.148 unknown Linux 2.4/2.6 Received: from [69.16.228.148] ([69.16.228.148:38715] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D5/A4-30437-CEB47494 for ; Tue, 16 Dec 2008 01:34:22 -0500 Received: from [83.228.56.37] (port=1799 helo=pc) by host.fmethod.com with esmtpa (Exim 4.69) (envelope-from ) id 1LCTVa-0001gk-66 for internals@lists.php.net; Tue, 16 Dec 2008 00:34:18 -0600 Message-ID: To: "PHP Developers Mailing List" References: <494698D3.2030801@lerdorf.com> <7977336F527D4A70B0E4DD2870708686@VEGA> <98b8086f0812151310v29603f68kafdb168c6c4e94e9@mail.gmail.com> <1229403515.27626.3.camel@localhost> Date: Tue, 16 Dec 2008 08:34:13 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.fmethod.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fmethod.com Subject: Re: [PHP-DEV] json_encode() From: sv_forums@fmethod.com ("Stan Vassilev | FM") Hi, JSON allows extensions. I can not understand why this is not an extension that makes sense: json_encode($var, $allowScalar = false); In PHP outputting of JS literals is a common action, so all you'll achieve by completely removing this option, is forcing people to go from this: echo 'var foo = '.json_encode("hello world"); ...to this: echo 'var foo = '.substr(json_encode(array("hi world")), 1, -1); A flag that defaults to false would be just as explicit and educational, and more efficient, than forcing hacks on us like the above one. Regards, Stan Vassilev