Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52584 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97401 invoked from network); 31 May 2011 21:37:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 May 2011 21:37:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=dukeofgaming@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dukeofgaming@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dukeofgaming@gmail.com X-Host-Fingerprint: 209.85.218.42 mail-yi0-f42.google.com Received: from [209.85.218.42] ([209.85.218.42:43500] helo=mail-yi0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/5D-25701-D7F55ED4 for ; Tue, 31 May 2011 17:37:03 -0400 Received: by yib12 with SMTP id 12so2302161yib.29 for ; Tue, 31 May 2011 14:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=Tu62LScF7GymVSmzmUOlyIVfZ//VK1h58xXRK0sI/s4=; b=iR/rjIiOsiXVeYzbLLRGg555NYjrMWORYKkDhU9nfHshhQfBk2R7ceVrrRIEiC/Xi3 McWRTqE+qvJtGu54bf3n1Qz0TFnWsCnpVbLRyWF3HcRhZYC7+yxR5Y/A8xNBfvm0YUCO 2dZKBFesd4ApATNtP6Cj5oAMBgrMvdK0L6h28= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=gxGKKpQyv6F6V0iHlw24Qj+mcl7LWMaPnkd3M6rEzBup4MLzwBHH9SwfcdUDTL1D5S zyKB9FqhsqNJE4RBk/BtFcRafAqHrxGNWKU5Adpv13LpPMappX3LQdLto9S4uTQM1I1s ehRgdAOQles1DtkbVnLtiiNYzlYnfHTHzJMqE= Received: by 10.101.143.1 with SMTP id v1mr4202777ann.21.1306877815118; Tue, 31 May 2011 14:36:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.96.15 with HTTP; Tue, 31 May 2011 14:36:35 -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 16:36:35 -0500 Message-ID: To: Stas Malyshev Cc: Rasmus , PHP internals Content-Type: multipart/alternative; boundary=0016e68deb77ef5a3004a499338c Subject: Re: [PHP-DEV] RFC: Short syntax for Arrays (redux) From: dukeofgaming@gmail.com (dukeofgaming) --0016e68deb77ef5a3004a499338c Content-Type: text/plain; charset=ISO-8859-1 Hi, I'm glad the topic has been picked up again, but I think there is an inconsistency in the proposal now that we are talking about being JSON-ish: JSON describes objects, not arrays. Then, what if "[]" were used for arrays and "{}" for objects?, so that: [1,2,3] //array(0=>1, 1=>2, 2=>3) ['one':1, 'two':2, 'three' : 3] // array('one'=>1, 'two'=>2, 'three' => 3) ['one':1, 'two':2, 'three' : 3] // (object)array('one'=>1, 'two'=>2, 'three' => 3) Regards, David On Tue, May 31, 2011 at 4: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 > > --0016e68deb77ef5a3004a499338c--