Issues

ZF-2609: ZCDispatcher_Standard shows notices when default module does not exist and/or was not set

Description

Assuming the simple following boostrap :


// ... some easy minimal code here
$frontController = Zend_Controller_Front::getInstance();
$frontController->addControllerDirectory($appDir . '/main/controllers','main');
$frontController->dispatch();

If I would like the 'main' module to be the default one, I should have written $frontController->setDefaultModule('main'); But I don't, I assume dispatcher will find it on its own.

If all right, then Dispatcher will dispatch my 'main' module (namespaced, that's correct as it's not declared as being the default module) but it will show some notices : Notice: Undefined index: default in path/to/Zend/Controller/Dispatcher/Standard.php on line 330

I think that the default module should be always set (id 'default' then the directory must exist or any declared with setDefaultModule()), and Dispatcher should throw an exception if it's not the case.

See the patch attached, that redefines the getActionMethod() for that. it seems to break some tests, maybe that's not a good patch, I'm on it.

Comments

This patch looks better

Here are the tests for the second patch.

Resolved in trunk. Passing the front controller or dispatcher parameter 'prefixDefaultModule' will ensure the controllers in the default module are namespaced.