Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.9.6
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Controller
-
Labels:None
Description
In the interface definition of the router it is stated that an exception should be thrown when no route matches the request. Instead it is currently simply ignored, which leads the request to the default controller/action, instead of going to the error controller which could emit a 404 error then. This can surely only happen, when the default module route was removed, which is intendend when you only want your own routes to match to avoid duplicate content for search engines.
I've attached a patch for this issue, but there's a problem. By applying this patch, the following two tests in Zend_Controller_Router_RewriteTest are breaking:
1. testRouteNotMatches: Expects the route() method to return an unchanged request object, which has NULL as controller, action and module set. This will lead the front controller to dispatch the standard parameters (default/index/index), which is the actual issue we want to solve tho. So rewriting this test would actually be the test for the new (correct) behaviour.
2. testRemoveDefaultRoutes: This one doesn't like that much like a problem, since the routing is not tested at all here, while there's still a not-tested call done to the route() method (which would usually add a default route if not disabled). This means we would just have to wrap a try {} around the route() call, and the test would suceed again. This shouldn't affect reallife applications, since there will never be no routes, and if, they should lead to the error controller.