ZF-5862: Filtering and validation arrays in Zend_Filter_Input
Description
if we have the form with being cloned on page with JS It is impossible to filter duplicates, empties, or validate them by count. Next code allows this. Like that: $filters=array( 'inp'=>'StripTags', 'inp_array'=>array('fields'=>'inp','array'=>true,'ArrEmptyItems','ArrDuplicates'); $validators=array( 'inp_array'=>array('fields'=>'cat','array'=>true,array('ArrCountBetween',1,10));
class Zend_Filter_Input2 extends Zend_Filter_Input {
protected function _filterRule(array $rule) {
if(@$rule['array']) {
$this->_data[$rule[self::FIELDS]]=array($this->_data[$rule[self::FIELDS]]);
parent::_filterRule($rule);
$this->_data[$rule[self::FIELDS]]=$this->_data[$rule[self::FIELDS]][0];
} else
parent::_filterRule($rule);
}
protected function _validateRule(array $rule) {
if(@$rule['array']) {
$this->_data[$rule[self::FIELDS]]=array($this->_data[$rule[self::FIELDS]]);
parent::_validateRule($rule);
$this->_validFields[$rule[self::FIELDS]]=$this->_validFields[$rule[self::FIELDS]][0];
} else
parent::_validateRule($rule);
}
}
Comments
Posted by Rob Allen (rob) on 2012-11-20T20:53:31.000+0000
Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".
Feel free to re-open and provide a patch if you want to fix this issue.