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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to