ZF-11276: Zend_Validate_Between
Description
H Zend Team, like i saw the Zend_Validate_Between supports only english float values like "2.09". It would be an good if it would support europe float convetion like "2,09". Here is my sulution: Replace isValid Mehtod by this:
public function isValid($value) { $this->_setValue($value);
$filter = new Zend_Filter_PregReplace(array('match' => '/\,/',
'replace' => '.'));
$value = $filter->filter($value);
if ($this->_inclusive) {
if ($this->_min > $value || $value > $this->_max) {
$this->_error(self::NOT_BETWEEN);
return false;
}
} else {
if ($this->_min >= $value || $value >= $this->_max) {
$this->_error(self::NOT_BETWEEN_STRICT);
return false;
}
}
return true;
}
Comments
Posted by Thomas Weidner (thomas) on 2011-04-09T20:20:51.000+0000
Duplication of ZF-6577
Posted by Thomas Weidner (thomas) on 2011-04-09T20:22:55.000+0000
Closing as duplicate
Note that the attached patch will not be integrated as it's behaviour is errorous.
Posted by Samuel (michizend) on 2011-04-10T21:15:54.000+0000
Because of the $this->_setValue($value); , or? filter than may fail?
Posted by Thomas Weidner (thomas) on 2011-04-16T22:21:34.000+0000
No.. the preg_replace itself would allow german numbers be validated in english environment and visa-versa. When we support localization then eighter all or non. The other issue was intended to add full localization. Therefor closing as duplicate and non-integration for this issue.