ZF-11645: Error when set dispatch on front controller

Issue Type: Bug Created: 2011-08-04T19:46:49.000+0000 Last Updated: 2012-06-17T13:59:46.000+0000 Status: Closed Fix version(s): Reporter: João Paulo de Oliveira Faria (jpfaria) Assignee: Ramon Henrique Ornelas (ramon) Tags: - Zend_Application

  • Zend_Controller
  • application
  • bootstrap
  • controller
  • dispatcher

Related issues: Attachments:


When I attempt set the dispatcher on my bootstrap file, the system generate an exception.


<pre class="literal"> 
class My_Dispatcher extends Zend_Controller_Dispatcher_Standard

<pre class="literal"> 
class My_Bootstrap extends Zend_Application_Bootstrap_Bootstrap
    public function _initMyFrontController()
        $frontController = $this->getResource('frontController');
        $frontController->setDispatcher(new My_Dispatcher());
        return $frontController;


<pre class="literal"> 
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'No default controller directory registered with front controller' in /home/jpfaria/public/apps/MenuTabletAdmin/library/Zend/Application/Bootstrap/Bootstrap.php:91 Stack trace: #0 /home/jpfaria/public/apps/MenuTabletAdmin/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #1 /home/jpfaria/public/apps/MenuTabletAdmin/public/index.php(25): Zend_Application->run() #2 {main} thrown in /home/jpfaria/public/apps/MenuTabletAdmin/library/Zend/Application/Bootstrap/Bootstrap.php on line 91


Posted by Matthew Weier O'Phinney (matthew) on 2011-08-04T20:47:51.000+0000

It looks to me like you're missing a directive in your configuration -- in INI format, this:

<pre class="highlight">
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

Also, you're not naming your bootstrap "Bootstrap" (no namespace), so you'll need to tell Zend_Application the bootstrap class name as well:

<pre class="highlight">
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "My_Bootstrap"

If those are already in your configuration, can you provide your full configuration, as well as the contents of your public/index.php file, please?

Posted by João Paulo de Oliveira Faria (jpfaria) on 2011-08-04T21:08:18.000+0000

Thank you for your quick post.

All settings are being passed perfectly. The proof of this is that if I modify the method getDispatcher of FrontController to:

<pre class="literal">

public function getDispatcher()
         * Instantiate the default dispatcher if one was not set.
        if (!$this->_dispatcher instanceof Zend_Controller_Dispatcher_Interface) {
            require_once 'My/Dispatcher.php';
            $this->_dispatcher = new My_Dispatcher();
        return $this->_dispatcher;

Works perfectly.

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.