Zend framework "invalid controller" error message

Posted by stef on Stack Overflow See other posts from Stack Overflow or by stef
Published on 2009-12-14T10:27:24Z Indexed on 2010/04/03 4:03 UTC
Read the original article Hit count: 510

Filed under:

When I load the homepage of a ZF site I get a message saying "Invalid controller specified (error)" where "error" seems to be the name of the controller.

In my bootstrap.php I have the snippet below where I added the prints statement in the catch():

// Dispatch the request using the front controller. 
try {   
    $frontController->dispatch();
}
catch (Exception $exception) {
    print $exception; exit;
    exit($exception->getMessage());
}

This prints out:

exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /www/common/ZendFramework/library16/Zend/Controller/Dispatcher/Standard.php:241
Stack trace:
#0 /www/common/ZendFramework/library16/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /www/site.com/htdocs/application/bootstrap.php(38): Zend_Controller_Front->dispatch()
#2 /www/site.com/htdocs/public/index.php(16): require('/www/site....')
#3 {main}

Can anyone make sense out of what it going on? I have a hunch it has something to do with case sensitivity and the naming conventions of ZF.

The initial "invalid controller" message comes from the snippet below

print $request->getControllerName();

        if (!$this->isDispatchable($request)) {
            $controller = $request->getControllerName();
            if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) {
                require_once 'Zend/Controller/Dispatcher/Exception.php';
                throw new Zend_Controller_Dispatcher_Exception('Invalid controller specified (' . $request->getControllerName() . ')');
            }
            $className = $this->getDefaultControllerClass($request);

        }

This all prints out "indexerrorInvalid controller specified (error)" so it looks like it's trying to load the index controller first, can not and then has a problem loading the error controller.

Could it just be that the path to the controller files is wrong?

© Stack Overflow or respective owner

Related posts about zend-framework