Re: Re: ext/filter, Final API proposal

From: Date: Tue, 19 Sep 2006 21:45:01 +0000
Subject: Re: Re: ext/filter, Final API proposal
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-25769@lists.php.net to get a copy of this message
Hello, On 9/19/06, Derick Rethans <derick@php.net> wrote:
unless FILTER_FLAG_ARRAY is given in which case it should behave like before. This would make it easier to use the filtered values IMHO.
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. I would not expect that... I thought the FLAG would just mean that it would iterate over a whole array and allow it. I think that we should add a second flag called "FORCE_ARRAY" or something instead.
The flag allows arrays and always returns an array. It is obvious as if you allow array or scalar, you have to use is_array, that's a step we easily drop internally by always returning an array. I do not see the point to have ALLOW_ARRAY and FORCE_ARRAY. It is confusing. --Pierre

« previous php.internals (#25769) next »