Re: ext/filter, Final API proposal
| From: | Christian Schneider | Date: | Sat, 16 Sep 2006 14:46:23 +0000 |
| Subject: | Re: ext/filter, Final API proposal | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-25732@lists.php.net to get a copy of this message | ||
Pierre wrote:
It always returns an array when FILTER_FLAG_ARRAY is given. Even when the input value was a scalar. It spares yet another is_array/isset test. And it accepts only scalar by default or when FILTER_FLAG_SCALAR is given.Makes sense but the example shows: $args = array( ...
'versions' => FILTER_SANITIZE_ENCODED,resulting in array(6) { ... ["versions"]=> array(1) {
[0]=>
string(6) "2.0.33"
}
instead of the (by me) expected
array(6) {
...
["versions"]=>
string(6) "2.0.33"even though FILTER_FLAG_ARRAY is not given for versions. I see three possibilities and wonder which one is true: a) This is a documentation bug b) FILTER_FLAG_ARRAY is 'inherited' from the previous arg ('component') c) The values are always returned as array My favourite one being a) :-)
It uses INPUT_REQUEST (which is not yet implemented, and will not be for 5.2.0). One should rely only on the constants not their values :)I agree wholeheartedly but I think it would be nice to have INPUT_REQUEST for 5.2.0 already. Or are you advising people to use $myinputs = input_get_args(INPUT_GET, $args, $data) + input_get_args(INPUT_POST, $args, $data) [ + ... ]; as work-around for now? Just wondering...
However, the point was about the API changes (signature, way to call them, etc...). I suppose you like it?Yes, the API looks great as far as I can tell. - Chris