Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 1.5.2
-
Fix Version/s: None
-
Component/s: Zend_Controller
-
Labels:None
Description
I think there is a bug in Zend/Controller/Dispatcher/Standard.php line 247.
Now: if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) {
Should be: if (!$this->getParam('useDefaultControllerAlways') && empty($controller)) {
Why? Even if we remove default routes ($router->removeDefaultRoutes(); ) we are always being redirected to index/index controller/action. So:
$front->throwExceptions(true) + $router->removeDefaultRoutes() = index/index
$front->throwExceptions(true) + #$router->removeDefaultRoutes() = exception
According to docs (http://framework.zend.com/manual/en/zend.controller.exceptions.html#zend.controller.exceptions.handling)
$dispatcher->setParam('useDefaultControllerAlways', true);
should switch between exception and default controller but now it isn't.
Of course, I could be wrong ![]()
edit: yes, it's definitely a bug. I've chcecked all possible combinations with routes / errorplugin / exception and now it's fine.
Actually, the current behavior is correct. When the useDefaultControllerAlways is set to true, then isDispatchable() will always return true – because it will resolve the invalid or empty controller to the default controller. I've tested extensively, and it works exactly as expected.
The one issue I've had with this is if I set the parameter after dispatch() has already been called on the front controller – i.e., from a plugin. In such a case, by the time that routeStartup() has hit, pushing the parameters into the front controller will have no effect on the router or dispatcher. If this is what you are doing, you may need to push that setParam() into your bootstrap or index.php prior to calling dispatch().