Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14515 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36425 invoked by uid 1010); 2 Feb 2005 05:50:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 36410 invoked from network); 2 Feb 2005 05:50:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2005 05:50:32 -0000 X-Host-Fingerprint: 64.233.184.207 wproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.184.207:41786] helo=wproxy.gmail.com) by pb1.pair.com (ecelerity HEAD (r4105:4106)) with SMTP id 1A/7A-00705-82A60024 for ; Wed, 02 Feb 2005 00:50:32 -0500 Received: by wproxy.gmail.com with SMTP id 49so74363wri for ; Tue, 01 Feb 2005 21:50:30 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=FoRvFQawOSU2YWKklqR1cftuo27+gdfY62qPwENb6PkTsovGOAHdhzQt9E5FMetlZ1LqMRRJMIKbL1Hh/IboSu6tLdfjm4GjutHL7qpnwktx+W12ovHHuFCsXDGxmVhB42D+aH9s0pvcskHfiFGd3EUGzzIQQHD4AaKajRSAeeQ= Received: by 10.54.59.18 with SMTP id h18mr145640wra; Tue, 01 Feb 2005 21:50:30 -0800 (PST) Received: by 10.54.20.78 with HTTP; Tue, 1 Feb 2005 21:50:30 -0800 (PST) Message-ID: <28139bc05020121503ff25b95@mail.gmail.com> Date: Wed, 2 Feb 2005 13:50:30 +0800 Reply-To: Xuefer Tinys To: Ryan King Cc: Sean Coates , internals@lists.php.net In-Reply-To: <562E08AE-74DA-11D9-9619-000D9331A4BC@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <5.1.0.14.2.20050201111730.0299da70@localhost> <5.1.0.14.2.20050201142816.026d21c0@localhost> <5.1.0.14.2.20050201151955.02730ec0@localhost> <4200169A.6050905@lerdorf.com> <420052A4.2040100@caedmon.net> <562E08AE-74DA-11D9-9619-000D9331A4BC@mac.com> Subject: Re: [PHP-DEV] PHP 5.1 From: xuefer@gmail.com (Xuefer Tinys) 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 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 > > >