> Also, I think you're getting confused over the zero with exactly what
> you are asking PHP to do. filter_var() returns true if the filter
> matches. If the 0 match is returned as a false, then filter_var() will

filter_var() actually returns the filtered data if the filter matches,
and FALSE if it doesn't. That's the whole point of the filter_XXX
functions; to pass a tainted value through a filter and get a clean,
"safe" value out the other end:

    $tainted = get_user_input();
    $clean = filter_var($tainted, [FILTER_CONSTANT]);
    // now use $clean and never touch $tainted again

>From the original code above, it looks like the OP was
misunderstanding the use of filter_var() and expecting it to return a


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to