Dmitry Stogov wrote: > +1 > > I like this solution and I don't think that BC break is important for many > applications. > Not a lot of them use is_array($GET), and I believe no one use > is_object($_GET). > $get = $_GET may be a problem, but moving from PHP5 to PHP6 won't easy in > any case.
a couple of views from an end-user POV: if your going to have a BC break concerning this you might consider using a differently named variable to $_GET - there are enough people that are only just getting to grips with $_GET (and learning about register-globals) - I foresee a lot of confused people with regard to $_GET having is semantic change, although no less 'annoying' for people who are confronted with a BC break having a new variable would at least mitigate some confusion. additionally using a fancy 'overloaded' object (as opposed to a straight forward object) is [probably] going to confuse alot of beginners. imho Pierre's suggestion of using the filter extensions 'interface' to solve the problem seems much more approachable and understandable for an average user. kind regards, > > Dmitry. > >> -----Original Message----- >> From: Sara Golemon [mailto:[EMAIL PROTECTED] >> Sent: Saturday, January 27, 2007 10:21 PM >> To: Andi Gutmans >> Cc: 'Pierre'; 'Andrei Zmievski'; 'Dmitry Stogov'; >> internals@lists.php.net; 'Zeev Suraski'; 'Stanislav Malyshev' >> Subject: [PHP-DEV] Objectified Request Parameters >> >> >> > Btw, having a request object was one of the #1 requests in >> framework >> :) People actually really like encapsulating this because it >> > also makes unit testing easier down the road... >> > Just mentioning this because I don't think we should be >> too set with >> our ways esp. for people who need to accomplish more >> > functionality. >> > >> For the record, I *do* prefer the simplicity of >> implementation of going >> with a request object, and I *personally* don't see it as a >> show-stopping BC break. Then again, I didn't see that >> fgets() change as >> show-stopping either. >> >> So let's start back from square one. How about a fresh round of >> discussion on the request object approach, in psuedo-code: >> >> class PHPGetObject implements ArrayAccess >> { >> private $decoded = array(); >> >> public function __offset_get($varname) >> { >> if (!isset($this->decoded[$varname])) { >> $val = http_decode_get($varname); >> $this->decoded[$varname] = $val; >> } >> >> return $this->decoded[$varname]; >> } >> /* plus set,isset,unset of course */ >> /* Probably need an iterator too */ >> } >> >> >> Pros: Fast, (mostly) clean, and cheap. >> Cons: Breaks the following BC bahaviors: >> * is_array($_GET) === false >> * is_object($_GET) === true >> * Referenceishness: >> $get = $_GET; >> $get['foo'] = 'bar'; >> var_dump($_GET['foo']); /* 'bar' */ >> >> My vote: +1 as I don't think the Cons are that serious. >> >> -Sara >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php