Somewhere between the 1.7.x branch and the current release, some major changes were made in Zend_Filter_Input. These changes caused numerous BC breaks, one of which I've reported:
http://framework.zend.com/issues/browse/ZF-7135 On Wed, Jul 8, 2009 at 1:45 PM, David Mintz<[email protected]> wrote: > I have a model class that has a validate($data) method. It puts together an > array of validators and eventually comes down to > > $input = new Zend_Filter_Input($filters,$validators,$data); > > In ZF 1.7.8, $input->getMessages() returns my custom error messages, works > just as I intend, but the same code in 1.8.2 (and 1.8.4) ignores my error > messages and instead returns the defaults > > The following is the array of validators in question (don't look too hard, > it's rather ugly): > > $validators = array( > > 'datetime' => array( > new SdnyDate(), > 'fields' =>array('date','time'), > 'breakChainOnFailure' => true, > 'presence' => 'required', > ), > 'time' => array( > 'NotEmpty', > 'presence' => 'required', > 'messages' => "Time is required", > ), > 'date' => array( > > 'NotEmpty', > 'Date', > > array('GreaterThan',date('Y-m-d',mktime(0,0,0,$today['mon'],$today['mday']-1,$today['year']))), > new Model_Validator_BusinessDay(), > 'presence' => 'required', > 'messages' => > array(0=>"Date is required",1=>"Invalid date ",2=>'This date > is in the past'), > 'breakChainOnFailure' => true, > ), > 'language_id'=> > array('NotEmpty', > array('InArray',(array_keys(Model_Languages::getAll(false)))), > 'presence' => 'required', > 'messages'=>array( > 0=>'The language field is required.', > 1 =>'Invalid language id', > ), > 'breakChainOnFailure' => true, > > ), > > 'judge_id'=>array( > 'NotEmpty', > > array('InArray',(array_keys(Model_Judges::getAllActive(false)))), > 'presence' => 'required', > 'messages'=>array(0=>'The judge field is > required.',1=>'Invalid judge id'), > 'breakChainOnFailure' => true, > ), > > // make the docket required, > // and make it match this format: nn-(CR|CIV|MAG|MISC)-x[xxx] > // javascript will help them get it right > 'docket'=>array( > 'NotEmpty', > new Zend_Validate_Regex(self::DOCKET_REGEX), > 'messages'=>array(0=>'Docket number is > required',1=>'Malformed docket number'), > 'breakChainOnFailure' => true, > ), > > 'proceeding_id'=>array('NotEmpty', > array('InArray',array_keys( > > Model_EventTypes::getAllForUserGroup(Zend_Auth::getInstance()->getIdentity()->group,false) > )), > 'presence' => 'required', > 'messages'=>array( > 0=>'The proceeding field is required yo.', > 1=>'Invalid proceeding id' > ), > 'breakChainOnFailure' => true, > ), > 'comments' =>array( > new > Zend_Validate_StringLength(0,$this->getTable()->_metadata['comments']['LENGTH']), > 'messages' > =>array(Zend_Validate_StringLength::TOO_LONG=>'Comments field exceeds > maximum length') > ), > // don't let them leave both defts and comments both empty > 'all_fields'=>array( > new Model_Validator_OneOrMoreFields(), > 'fields'=>array('comments','deft_ids'), > 'messages'=>array("Please enter the defendant(s) > name(s). If a defendant is not found by using the autocompleting field > below, please enter the name in the comments field.") > ), > ); > > Any idea what am I doing wrong? > > Thanks. > > -- > David Mintz > http://davidmintz.org/ > > The subtle source is clear and bright > The tributary streams flow through the darkness > -- Jordan Ryan Moore
