Zend Framework

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

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.4
  • Fix Version/s: 1.11.6
  • Component/s: Zend_Dojo
  • Labels:
    None

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 . '</form>'; }
.......
}

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?

  1. ZF-5814.diff
    23/Apr/11 4:43 PM
    0.4 kB
    Robert Basic
  2. ZF-5814-tests.diff
    23/Apr/11 4:43 PM
    0.5 kB
    Robert Basic

Issue Links

Activity

Hide
Pavel Vrany added a comment -

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!

Show
Pavel Vrany added a comment - 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!
Hide
Tridem added a comment -

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

Show
Tridem added a comment - It would be nice to have the captureStart() and captureEnd() methods available for this case.
Hide
Robert Basic added a comment -

Attaching patch and tests.

Show
Robert Basic added a comment - Attaching patch and tests.
Hide
Matthew Weier O'Phinney added a comment -

Patches reviewed and applied to trunk and 1.11 release branch.

Show
Matthew Weier O'Phinney added a comment - Patches reviewed and applied to trunk and 1.11 release branch.
Hide
Robert Basic added a comment -

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

Show
Robert Basic added a comment - Pull request for porting the patch in ZF2 is sent: https://github.com/zendframework/zf2/pull/271

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: