Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52586 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99839 invoked from network); 31 May 2011 21:39:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 May 2011 21:39:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=ilia@prohost.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ilia@prohost.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain prohost.org designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: ilia@prohost.org X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:42296] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/ED-25701-B0065ED4 for ; Tue, 31 May 2011 17:39:25 -0400 Received: by bwz18 with SMTP id 18so4481898bwz.29 for ; Tue, 31 May 2011 14:39:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.139.199 with SMTP id f7mr4933094bku.23.1306877960203; Tue, 31 May 2011 14:39:20 -0700 (PDT) Received: by 10.204.72.3 with HTTP; Tue, 31 May 2011 14:39:20 -0700 (PDT) In-Reply-To: <4DE55CDA.302@sugarcrm.com> References: <4DE5368A.6050603@moonspot.net> <2BFFEAC1-395E-4101-9452-002E63DCFD91@seancoates.com> <4DE55AB7.9050206@lerdorf.com> <4DE55CDA.302@sugarcrm.com> Date: Tue, 31 May 2011 23:39:20 +0200 Message-ID: To: Stas Malyshev Cc: Rasmus , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] RFC: Short syntax for Arrays (redux) From: ilia@prohost.org (Ilia Alshanetsky) Stas, Why would you use eval() as opposed to json_decode() ? On Tue, May 31, 2011 at 11:25 PM, Stas Malyshev wrote: > Hi! > >> Stas, I didn't understand your point about eval() and security. What did >> you mean? > > I meant if PHP has JSON syntax as native, e.g. you can say something like: > > $a = {"a":"b"}; > > Then the temptation would be to write something like: > > // $json_string is {"a":"b"} > $a = eval($json_string); > > just as Javascript programmers sometimes do. That would have the same > security implications as it has in Javasctipt - somebody could inject > executable code there, etc. Of course, nobody forces you to do this, but the > temptation would be there. > > Also, with full JSON support it is not entirely clear to me what {"a": "b"} > would mean - is it an array or an object? In JS, it's definitely an object, > but in PHP objects are almost never used to store pure state without > behavior, because we have hashtable arrays, while JS only has vector arrays. > So here we have some unclear point (which does not happen with [] syntax, > since with [] it's obvious we're talking about arrays, just as in many other > languages). > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >