Issues

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

Issue Type: Bug Created: 2009-02-17T08:52:50.000+0000 Last Updated: 2011-07-28T15:29:53.000+0000 Status: Resolved Fix version(s): - 1.11.6 (05/May/11)

Reporter: Krasimir Yosifov (x3mer) Assignee: Robert Basic (robertbasic) Tags: - Zend_Dojo

Related issues: - ZF-5931

Attachments: - ZF-5814-tests.diff

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

Posted by Pavel Vrany (derk) on 2009-08-18T09:44:41.000+0000

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!

Posted by Webdevilopers (tridem) on 2010-06-30T01:08:19.000+0000

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

Posted by Robert Basic (robertbasic) on 2011-04-23T16:43:29.000+0000

Attaching patch and tests.

Posted by Matthew Weier O'Phinney (matthew) on 2011-05-02T19:25:22.000+0000

Patches reviewed and applied to trunk and 1.11 release branch.

Posted by Robert Basic (robertbasic) on 2011-07-28T15:29:53.000+0000

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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts