Improving performance on digit filtering

This commit is contained in:
Yanick Witschi 2012-02-21 18:08:57 +01:00
parent 9356be3a1b
commit 4f8e8efe08

View File

@ -229,7 +229,8 @@ class ParameterBag
*/
public function getDigits($key, $default = '', $deep = false)
{
return preg_replace('/[^[:digit:]]/', '', $this->get($key, $default, $deep));
// we need to remove - and + because they're allowed in the filter
return str_replace(array('-','+'),'', $this->filter($key, $default, $deep, FILTER_SANITIZE_NUMBER_INT));
}
/**