Floats and thus the function floatval() used to test filtered value in Zend_Validate_Float::isValid() is locale aware and return value with localized decimal_point. Thus the test will always fail when a locale is set which uses a decimal point other than ".". Tested with PHP 5.2.6.2.
When...
setlocale(LC_ALL, 'sv_SE.UTF-8');
$value = 10.5;
...this will always fail as it results in a comparison between "10,5" and "10.5".
if (strval(floatval($valueFiltered)) != $valueFiltered) {
$this->_error();
return false;
}
Proposed solution
list($num, $dec) = explode('.', $valueFiltered);
if (strval(intval($num)) != $num || strval(intval($dec)) != $dec) {
$this->_error();
return false;
}
There are also no unit test Zend_Validate_Float with a locale other than default.
This new feature has been added 3 months ago.
It will be released with 1.8.