Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42241 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67376 invoked from network); 14 Dec 2008 04:19:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Dec 2008 04:19:18 -0000 Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; 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:59018] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/81-47862-44984494 for ; Sat, 13 Dec 2008 23:19:16 -0500 Received: from [83.228.56.37] (port=4085 helo=pc) by host.fmethod.com with esmtpa (Exim 4.69) (envelope-from ) id 1LBiRk-0001hI-LB for internals@lists.php.net; Sat, 13 Dec 2008 22:19:13 -0600 Message-ID: <15E310EAB433466EAF996B252CBED2BB@pc> To: "'PHP Developers Mailing List'" References: <2D85B33E-889B-4214-9BB8-A12EFFFC641E@macvicar.net> <1229150500.30719.201.camel@localhost> <4BA26FE8A9634178B4CEBEFA818810D2@VEGA> Date: Sun, 14 Dec 2008 06:19:04 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; 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] Removing basic types from our JSON parser From: sv_forums@fmethod.com ("Stan Vassilev | FM") >> var foo = ; >> ... (yes, they maybe heared somewhere that JSON is *not* javascript, I >> told 'em too). JSON is a strict subset of JavaScript, and the above scenario is something I also do often. Since PHP generates web pages, any time I need to generate a JS literal json_encode() is the natural equivalent of var_export(.., true) for PHP literals. Since it may not match the RFC apparently, I suggest a flag as some other people said: function json_encode($var, $allowScalar = false) {} This way we gain best of both worlds without disrupting either specs nor existing workflows. Regards, Stan Vassilev