If you have been monitoring PHP's internal mailing list you probably know that over the last few weeks we've been locked in a stalemate in regard to the API revision of the filter extension brought to light by Dan from our documentation team. This is also the reason why despite this being early October PHP 5.2 is still not out.
Fortunately, after mediation with
Derick and
Pierre the two protagonists of the filter conundrum a compromise was finally reached. I took Pierre's proposed patch for the filter extension and based on it made a fairly series of adjustments yielding a very clear and flexible API (I hope) that seems to keep everyone happy. The patch was committed late last night and given lack of complaints today, I think we've finally got this issue resolved. YEY!
The only downside, is that my proposal to rename the filter extension to "Ilia' Awesome Filter Extension" was shot-down, with only Tony being in favor, oh well, I guess you can't have it all.
On a related note, since filter issue is now resolved, we can resume with the 5.2 release cycle and I hope to have RC5 out this Thursday to be followed shortly with a final release. On the bright side, the delay allowed us to fix about a dozen bugs and make PHP 5.2 even faster by fixing an
inefficiency spotted by Matt W. related to creation of hash tables with known sizes.
Here is a brief overview of the filter function API and short descriptions of what the functions do. If you'd like more information take a look at the tests found within the filter extension.
filter_input() - Fetch an element from a given input source and return a filtered variant of the data.
filter_var() - Filter a PHP variable which can be either a scalar or an array (if flag indicating that arrays are allowed is passed).
filter_input_array() - Filter entire set of input arguments based on definitions provided in a form of another array.
filter_var_array() - Filter a variable containing an array based on definitions provided in a form of another array.
filter_list() - Get an array of all the available filters.
filter_id() - Return a filter name based on a filter's numeric identifier.
filter_has_var() - Determine if a variable is found within a particular input source.
Other changes to the filter extension include:
1) Added recursion protection.
2) Introduced 2 flags, FILTER_REQUIRE_SCALAR & FILTER_REQUIRE_ARRAY that allow you to identify the desired input type.
3) Introduced FILTER_FORCE_ARRAY flag that forces a scalar output to be returned in a form of an array.