ZF-11579: Resource_View should not create ViewRenderer object itself

Description

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.


// diff
public function init()
    {
        $view = $this->getView();

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

Comments

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