ZF-11577: htmlspecialchars() expects parameter 1 to be string, array given

Description

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /usr/share/php/libzend-framework-php/Zend/View/Abstract.php on line 897.

this is code from form, $this->setDecorators(array( 'FormElements', array('Errors', array('placement' => 'PREPEND')), array('HtmlTag', array('tag' => 'dl', 'class' => 'login_elements')), 'Form' ));

everything is ok until array('Errors', array('placement' => 'PREPEND')) is put into setDecorators or just 'Errors' ...

Comments

There's a difference if the errors messages comes from an element or from the form.


array(1) {
  ["isEmpty"]=>
  string(36) "Value is required and can't be empty"
}

array(1) {
  ["foo"]=>
  array(1) {
    ["isEmpty"]=>
    string(36) "Value is required and can't be empty"
  }
}

At the moment it is a bad idea to use the "Errors" decorator for the whole form, because there is no reference to the element or to the label of the element.

We need a solution which respects the array from the form and which outputs the label from the element.


Foo: Value is required and can't be empty

There is already a special decorator (and view helper) for displaying errors at the form level, "FormErrors"; use that instead of the "Errors" decorator.

Matthew is right. Damn, I use it even in my own scripts!

Thanks to Matthew.