Hi, I'm pretty new to ZF, but I've searched around quite a bit to try and find a solution for this and thus far failed and I was hoping someone here could point me in the right direction.
I'm creating a class that extends the Zend_Db_Table_Abstract class which will be a parent class to all our model classes and has the following function to validate data before data is inserted or updated: ************ class OurBaseTable extends Zend_Db_Table_Abstract { protected $_filters = null; protected $_validators = null; protected $_valid; protected function isValidGeneral(array $data, $options=null) { $input = new Zend_Filter_Input($this->_filters,$this->_validators,$data,$options); if($input->hasInvalid()){ return $input->getMessages(); } else if($input->hasMissing()){ $valid = false; return $input->getMissing(); } else { return $data; } } } ************* I'll call the isValidGeneral() function from a subclass like so (this is just testing currently, so I print out whatever is returned by the isValidGeneral() function: ************* class FirstClass extends OurBaseTable { protected $_validators = array( 'field1' => 'Alpha', 'field2' => array('Digits',array('StringLength',false,array(1,1))), 'field3' => array('Digits') ); protected $_filters = null; public function update(array $data, $where) { $valid = $this->isValidGeneral($data); if($valid===true) { print("TRUE"); } else { print_r($valid); } } } ************** My problem is that, for example, if someone puts a single quote in field1 and then I try to access the getMessages array, the script crashes. If I enter "O'Brien" as field1 and print out the getMessages return array, I get: Array ( [lname] => Array ( [notAlpha] => ' and everything screeches to a halt. Is there a way around this without allowing the quotes (it's not a name field and should be alpha only!)? I may be overcomplicating the whole thing and, in my frustration, overlooking some simple fix. Any help is appreciated. Thanks! -- View this message in context: http://www.nabble.com/getMessages%28%29-crashes-with-quotes%21-tp21793751p21793751.html Sent from the Zend Framework mailing list archive at Nabble.com.