ZF-3456: Zend_View_Helper_Action Issue, duplicated view output

Issue Type: Bug Created: 2008-06-13T09:49:01.000+0000 Last Updated: 2008-07-25T15:17:10.000+0000 Status: Resolved Fix version(s): - 1.5.3 (28/Jul/08)

Reporter: Juan Felipe Alvarez Saldarriaga (jfalvarez) Assignee: Ralph Schindler (ralph) Tags: - Zend_View

Related issues: - ZF-3160

Attachments: - ZF-3456-fix.patch



A view named "view-chart.phtml" execute the action helper, action( "show-chart-main-panel", "diagnostic", "platform", array( "patient\_id" => $this->intPatientId ) ); ?>, then the view of the second action ( "show-chart-main-panel" ) execute another action helper action( "show-record-image", "patient", "platform", array ( 'patient\_id' => $this->intPatientId, 'patient\_record\_id' => $this->intPatientRecordId, 'field\_id' => $this->intFieldId ) ); ?>, what's the issue ? the output of "show-record-image" appears twice on the "view-chart.phtml", any help ?

  • view-chart.phtml:

View Chart:

action( "show-chart-main-panel", "diagnostic", "platform", array( "patient\_id" => $this->intPatientId ) ); ?>
  • view-chart.phtml calls "show-chart-main-panel" action, this is the view of "show-chart-main-panel" action, show-chart-main-panel.phtml:

Show Cart Main Panel:

action( "show-record-image", "patient", "platform", array ( 'patient\_id' => $this->intPatientId, 'patient\_record\_id' => $this->intPatientRecordId, 'field\_id' => $this->intFieldId ) ); ?>
  • show-record-image.phtml:

Show Record

This is the final result:

View Chart:

Show Record

Show Cart Main Panel:

Show Record

"show-record-image" string is duplicated, any help ? Thx.


Posted by Matthew Weier O'Phinney (matthew) on 2008-06-16T09:04:27.000+0000

Assigning to Ralph; Ralph, please review and attempt a fix for the next mini release.

Posted by Paul Tomlin (ptomli) on 2008-07-17T03:44:19.000+0000

I can confirm the issue, and have worked out some vague understanding of the reason, and a solution.

It appears that nested actions prepend the previous response, or append the current one (depending on your standpoint)

If C actions B actions A

A results in A B results in ABA (should be BA) C results in ABACABA (should be CBA)

Blind digging in the code brought me to think this might have something to do with the fact that the request/response instances used in the helper are cloned in the constructor, and remain the same instances throughout the lifetime of the helper.

Exactly how this creates the situation above I have no idea, but creating new clones of the request/response objects (from the front controller) at the start of the 'action' method, and using them instead of the instance members produces the correct response.

I'd attach a patch, but I think someone who understands the issue would be better placed to produce something suitable.

Posted by Paul Tomlin (ptomli) on 2008-07-19T00:33:00.000+0000

A test and example fix.

Posted by Ralph Schindler (ralph) on 2008-07-25T15:11:57.000+0000

Fixed in 1.5.3 at r10440 Fixed in 1.6.0 at r10442

Have you found an issue?

See the Overview section for more details.


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

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