ZF-9649: Zend_Validate_PostCode and Zend_Validate_CreditCard, call the method _setValue after of validated a input in method isValid
Description
Most validators has the behavior: The input value :>isValue($value), is only assigned :>value after being validated.
Zend_Validate_PostCode and Zend_Validate_CreditCard, hurt this behavior, in method isValid().
Example current code:
$this->_setValue($value);
if (!is_string($value)) {
$this->_error(self::INVALID);
return false;
}
I think what should be:
if (!is_string($value)) {
$this->_error(self::INVALID);
return false;
}
$this->_setValue($value);
Comments
Posted by Thomas Weidner (thomas) on 2010-04-11T10:36:14.000+0000
Closing as non-issue.
There is no such rule.
The value has to be set BEFORE it is being used within an error message. And this is done within all validators.
Posted by Ramon Henrique Ornelas (ramon) on 2010-04-11T11:18:14.000+0000
@Thomas Most validators has this behavior.
Example:
In PostCode and CreditCard:
What would be the correct?