ZF-6747: Zend/Application/Resource/Navigation issue

Issue Type: Bug Created: 2009-05-20T08:40:17.000+0000 Last Updated: 2011-06-04T00:39:37.000+0000 Status: Resolved Fix version(s): Reporter: bullfrogblues (gerardroche) Assignee: Dolf Schimmel (Freeaqingme) (freak) Tags: - Zend_Application

Related issues: - ZF-7061



Fatal error when using Zend_Application Navigation Resource with custom view resource in bootstrap

ref: possibly related…


Set up a ZF project via Quickstart zf Command Line Tool (which is great :))

Add to application.ini

resources.view[] = resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.navigation.pages.indexFoo.label = "Foo" resources.navigation.pages.indexFoo.controller = "index" resources.navigation.pages.indexFoo.action = "foo" resources.navigation.pages.indexBar.label = "Bar" resources.navigation.pages.indexBar.controller = "index" resources.navigation.pages.indexBar.action = "bar"

In the view

echo $this->navigation()->menu();

Everything works great, the menu is echoed as expected.

But if you now add a custom view resource in the bootstrap the menu disappears?


protected function _initView()
    // Initialize view
    $view = new Zend_View();
    $view->headTitle('My First Zend Framework Application');

    // Add it to the ViewRenderer
    $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(

    // Return it, so that it can be stored by the bootstrap
    return $view;

if you then comment out view resource config in application.ini i.e. ;resources.view[] =

you get a fatal error:

Fatal error: Call to a member function getView() on a non-object in path\to\1.8.1\library\Zend\Application\Resource\Navigation.php on line 100


Posted by Matthew Weier O'Phinney (matthew) on 2009-05-20T09:29:31.000+0000

Assigning to Robin.

Posted by Robin Skoglund (robinsk) on 2009-05-20T09:41:42.000+0000

Assigning to Dolf, because he wrote the navigation resource (plus I'm super busy until june, and not too familiar with Zend_Application yet).

Posted by bullfrogblues (gerardroche) on 2009-06-18T07:06:43.000+0000

I set the priority of this issue to minor when creating it though I think it should be upgraded.


Use of the navigation resource (from configs file e.g ini) requires altering any bootstraps in your app that use a view initializer i.e. "_initView()" . And though making the changes may very well be trivial I think the upgrade of priority is justified.

FYI: The workaround for use of the navigation resource from configs is simply to rename your view inializer and retrieving the view resource for manipulation:

<pre class="literal"> 
    public function _initViewNotNamedInitView()
        $view = $this->bootstrap('view')->getResource('view');
        // now make your changes to the view

Posted by Marco Frank (melchior) on 2009-06-21T00:21:11.000+0000

I think the problem lies in Zend_Application_Resource_View

The navigation view helper always tries to get the view by: (row.99)

$view = $this->getBootstrap()->getPluginResource('view')->getView();

I use custom smarty view class, that gets initialized in Bootstrap.php. So the view plugin resource never knows from smarty view because it never gets (wanted) used/inited.

related issue in zend view resource:

regards, marco

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-07-23T19:47:17.000+0000

Fixed with r17016 Merged into 1.9 branch with r17017

Posted by Jon (ding) on 2011-05-11T19:29:28.000+0000

This issue is still present in 1.11.6 using the setup from documentation:…

By putting that into the application.ini the very same fatal error appears.

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2011-06-04T00:39:37.000+0000

Yet I've been unable to think of a unittest that would demonstrate this 'faulty' behavior. Please provide a unittest that currently fails, and would pass after the issue has been fixed. If none can be provided I'll once again close this issue as resolved.

Thank you for helping making ZF better.

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.