Re: PHP 5.1

From: Date: Wed, 02 Feb 2005 05:50:30 +0000
Subject: Re: PHP 5.1
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-14515@lists.php.net to get a copy of this message
more choices: foo_bar(string $key or array $keys, int or string $how) bar can be one of get,post,request,env,server foo may be filter? ifilter? (i for input) may foo be empty? _get _post etc.. $how is default to FILTER_RAW so we have _get("abc") and _GET("abc") for raw data same as $_GET['abc'] before. it's just simple and it would make user easy to migrate their thinking, not just the script we had made too much changes: $abc -> $HTTP_GET_VARS['abc'] -> $_GET['abc'] -> _GET('abc') or filter_xxx(GET...) On Tue, 1 Feb 2005 21:21:47 -0800, Ryan King <ryansking@mac.com> wrote: > On Feb 1, 2005, at 8:10 PM, Sean Coates wrote: > > > Rasmus Lerdorf wrote: > >> As someone suggested, if the filter function could do $GET = > >> filt(GET,'*',FILTER_TAGS) or something to that effect then an > >> individual script could in one shot filter all GET data even if the > >> default ini filter wasn't in place. > > > > Might I suggest: > > > > foo_filter($type, $keys, FILTER_TAGS); > > > > where $type and $keys are strings (as originally intended), or they > > could be arrays of types and keys (similar to how str_replace works). > > > > //example > > foo_filter(array(FOO_GET, FOO_POST, FOO_ENV), array('bar','baz'), > > FOO_TYPE_TAGS); > > > > This way we could easily filter a large number (or all) keys from many > > request types in one command: > > > > /* filter all tags from all get vars */ > > foo_filter(FOO_GET, array_keys($_GET), FOO_TYPE_TAGS); > > //and > > /* filter all tags from all POST vars, except $_POST['baz']; > > foo_filter(FOO_POST, array_diff(array_keys($_POST), array('baz')), > > FOO_TYPE_TAGS); > > > > Would also be nice if the third parameter was a bitfield: > > foo_filter(FOO_POST, 'bar', FOO_TYPE_ALL &~ FOO_TYPE_QUOTES); > > Wouldn't this make it more difficult to be extended by a user. The way > I imagine it working now is like this: > > function my_filter () > { > //blah blah > } > > define('FOO_MY_FILTER', 'myfilter'); > > foo_filter(FOO_POST, 'bar', FOO_MY_FILTER); > > Then the constant really just becomes a callback and I can add anything > in that I want. > > Maybe? > > -ryan > > -- > http://theryanking.com/blog > > >

« previous php.internals (#14515) next »