Permalink
Browse files

Merge branch 'hotfix/zf2-569' into develop

Forward port #2388

Conflicts:
	library/Zend/I18n/Validator/Float.php
	tests/ZendTest/I18n/Validator/FloatTest.php
  • Loading branch information...
2 parents 15fa021 + 49453f9 commit 14737f3be77ee98a257016f81bca6954c70ea6f1 @weierophinney weierophinney committed Sep 19, 2012
Showing with 9 additions and 1 deletion.
  1. +7 −1 library/Zend/I18n/Validator/Float.php
  2. +2 −0 tests/ZendTest/I18n/Validator/FloatTest.php
@@ -123,7 +123,13 @@ public function isValid($value)
$valueFiltered = str_replace($groupingSep, '', $value);
$valueFiltered = str_replace($decimalSep, '.', $valueFiltered);
- if (strval($parsedFloat) != $valueFiltered) {
+ while (strpos($valueFiltered, '.') !== false
+ && (substr($valueFiltered, -1) == '0' || substr($valueFiltered, -1) == '.')
+ ) {
+ $valueFiltered = substr($valueFiltered, 0, strlen($valueFiltered) - 1);
+ }
+
+ if (strval($parsedFloat) !== $valueFiltered) {
$this->error(self::NOT_FLOAT);
return false;
}
@@ -60,6 +60,8 @@ public function basicProvider()
array(-0.1, true),
array('10.1', true),
array('5.00', true),
+ array('10.0', true),
+ array('10.10', true),
array(1, true),
array('10.1not a float', false),
);

0 comments on commit 14737f3

Please sign in to comment.