Re: PHP 5.1

From: Date: Wed, 02 Feb 2005 04:10:12 +0000
Subject: Re: PHP 5.1
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-14507@lists.php.net to get a copy of this message
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); S

« previous php.internals (#14507) next »