Issues

ZF-5814: Zend_Dojo_View_Helper_Form::form() changes the $content argument incompatibally to Zend_View_Helper_Form::form()

Description

Hi folks,

After adding the dojo hepers path to my $view object i found that my form helpers are not working as I expected to. Previously it was generating open FORM tag and not closing it (my 3-rd argument is not set or it is the default 'false'), but the dojo extended helper closes the form! I compared the two helpers and saw the problem:

Zend_View_Helper_Form

.... public function form($name, $attribs = null, $content = false) { ..... if (false !== $content) { $xhtml .= $content . ''; } ....... }

Acording to this logic, the helper closes the form tag if the $content argument is not exactly boolean false. So far it is ok because I didn't passed the third argument, but in the child class there is different logic for the third argument:

Zend_Dojo_View_Helper_Form

.... public function form($id, $attribs = null, $content = false) { ..... if (false === $content) { $content = ''; } ....... }

So the sutiation is that: - I'm not passing the third argument, and it's value is the default 'false' as defined in the method prototype. So the "if (false === $content)" enters to its true block and alternates $content to empty string, and then uses the old helper Zend_View_Helper_Form::form() with incorrect 3-rd argument value.

Am I wrong?

Comments

Also confirmed in 1.9.1., Zend_Dojo_View_Helper_Form is broken. This terrible error is reported many months ago, including repairs and has not yet been corrected!

It would be nice to have the captureStart() and captureEnd() methods available for this case.

Attaching patch and tests.

Patches reviewed and applied to trunk and 1.11 release branch.

Pull request for porting the patch in ZF2 is sent: https://github.com/zendframework/zf2/pull/271