ZF-11579: Resource_View should not create ViewRenderer object itself

Issue Type: Bug Created: 2011-07-19T12:16:07.000+0000 Last Updated: 2011-07-28T20:40:02.000+0000 Status: Resolved Fix version(s): - 1.11.10 (04/Aug/11)

Reporter: julien PAULI (doctorrock83) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Application_Resource

Related issues: Attachments:


ZA_Resource_View creates itself a ViewRenderer and registers it in the HelperBroker stack. It should not create the ViewRenderer, but instead, rely on HelperBroker to lazy-load it.

When back-adding the created ViewRenderer into HelperBroker, it is created with a wrong name into the HelperBroker stack. Then, if ZA_Resource_View gets loaded after a plugin that did play with the ViewRenderer, we got two ViewRenderer objects in memory.

<pre class="highlight">
// diff
public function init()
        $view = $this->getView();

-       $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
+       $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
-       Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
        return $view;


Posted by Matthew Weier O'Phinney (matthew) on 2011-07-28T20:40:02.000+0000

Added a test for this, and applied the patch in trunk and the 1.11 release branch. Thanks!

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.