Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58025 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39871 invoked from network); 24 Feb 2012 21:23:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2012 21:23:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:3509] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/8A-17132-2CFF74F4 for ; Fri, 24 Feb 2012 16:23:15 -0500 Received: (qmail 27860 invoked by uid 98); 24 Feb 2012 21:23:15 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 ( Clear:RC:1(127.0.0.1):. Processed in 0.036835 secs); 24 Feb 2012 21:23:15 -0000 Received: from localhost (HELO www.l-i-e.com) (127.0.0.1) by localhost with SMTP; 24 Feb 2012 21:23:15 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Fri, 24 Feb 2012 15:23:15 -0600 Message-ID: <87e1cec98115b9becc997a68effea72b.squirrel@www.l-i-e.com> In-Reply-To: References: Date: Fri, 24 Feb 2012 15:23:15 -0600 To: "PHP Internals List" User-Agent: SquirrelMail/1.4.21 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] $_PARAMETERS Super Global Object From: ceo@l-i-e.com ("Richard Lynch") On Wed, February 22, 2012 8:57 am, Michael Morris wrote: > Before writing up a full RFC I want to put out a feeler on something. > Currently we have several input parameter objects, chief among them > $_GET, $_POST, $_REQUEST, $_SERVER (for the client HTTP headers). All > of them are arrays and legacy code sometimes writes to them. Locking > them as read only objects would cause a major BC break. > > What if instead we had an Object called $_PARAMETERS which holds the > read only copies of this data. In addition, this would be the first > superglobal object, able to perform some filtering of inputs. Basic > idea.. > > $_PARAMETERS > ->get > ->post > ->cookie > ->headers (The client http headers) > > All of these would be array objects, and all would be read only and > have these methods and properties > > ->filtered: Copy of the array according to the current set filters of > the object. > ->setFilters(): Sets the filters of the input, an array with constant > values for the allowed types. > > And I'll stop there. The basic idea, to add a read only input hive > with some basic object functionality for filtering. I can see how you would want this, but it seems to me that you can code this easily enough in PHP, with a singleton class with private read-only properties that initialize to the various $_XXX values, and a filter method that employs PHP FILTER. Personally, I think introducing a whole new feature to be maintained and documented to save defining a couple simple classes and a page of code is not a "win". -- brain cancer update: http://richardlynch.blogspot.com/search/label/brain%20tumor Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE