Issues

ZF-5849: rendering formErrors Decorator w/ no error messages

Description

When I passed a empty array to formErrors in a view its generate '

<

ul>

'. I think it would be better if no text was displayed.

This can be done if in formErrors method we do a size verification in $errors paramenter:

public function formErrors($errors, array $options = null)
{
    if (count($errors) > 0) {
         ...
    }
    return $html;
}

Comments

Patch file to tests/Zend/Form/Decorator/FormErrorsTest.php

This introduces a test case for this "bug". The test passes with the code as is.

Lines 89-91 of library/Zend/Form/Decorator/FormErrors.php contain an empty() check that handles this already. (Not sure when it was introduced.)

I built a test case for this (see patch) -- the test already passes (in trunk).

I don't know if this was added after the case was reported and when. (I noticed this at some point after 1.7 though.)

This just needs to be confirmed and closed (I wasn't sure if I was allowed to do that.)--- there's a perfectly good test case that can be added too in the patch file.