ZF-9580: Zend_View_Helper_FormErrors does not accept string instead of array
Description
class: Zend_View_Helper_FormErrors method: formErrors param: $errors may be either a string or an array
The code to format the html casts to an array, but this should be done before escaping (the code directly above and probably added in a later stadium).
Comments
Posted by Christopher Manning (manningc) on 2010-09-24T13:55:40.000+0000
I am experiencing a bug related to this.
I am using $form->renderErrors() to display form errors in my view and I also added the Error decorator to the form ($form->addDecorator('Errors');)
In my case $errors = array('formfieldname'=>array('isEmpty'=>'Value is required and can't be empty'));
When Zend_View_Helper_FormErrors on L:79 it iterates through $errors to escape them, it will pass an array to $this->view->escape and not return correctly
In Zend_View_Abstract on L:897 it should exception if the $var supplied is not a string since 'htmlspecialchars', 'htmlentities' only accepts a string as their first parameter.