9
I’m testing a PHP value filter function called filter_var(). And a of your filters, focused on values like int seems to accept any combination of numbers, + and -. Example:
filter_var("1teste2", FILTER_SANITIZE_NUMBER_INT) // 12
filter_var("1-teste-2", FILTER_SANITIZE_NUMBER_INT) // 1--2
filter_var("1--1--+--1", FILTER_SANITIZE_NUMBER_INT) // 1--1--+--1
Is this a normal behavior? The language accepts this type of value as int without problems, or is a bug of the filter function?
$var = preg_replace_all('~[^\d+-]~', '', $var);– Guilherme Lautert