Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.10.0
-
Fix Version/s: 1.11.0
-
Component/s: Zend_Controller
-
Labels:None
Description
When you define a chain with the default Module route as a final route in the chain the route will fail when the url doesn't explicitly contain a controller or module.
The following example will fail:
public function testChainingDynamicModuleDefaultModuleMatch() { $foo = new Zend_Controller_Router_Route(':dynamic'); $dispatcher = new Zend_Controller_Router_ChainTest_Dispatcher(); $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo'); $bar = new Zend_Controller_Router_Route_Module(array(),$dispatcher,$request); $chain = $foo->chain($bar); $res = $chain->match($request); $this->assertEquals('foo', $res['dynamic']); $this->assertEquals('defctrl', $res['controller']); $this->assertEquals('defact', $res['action']); $this->assertEquals('default', $res['module']); }
It doesn't matter if the first route is a static route or (in the above case) a dynamic one.
My patch is an adjustment of the assertion that happens in Chain::match(). In my opinion it should check if the last route is or isn't of the Module type since the Module route normally contains defaults for module, controller and action.
I'll attach a patch I've made.
The patch I've included contains (besides the fix for Chain) also an modification of the unit tests.
Of course, if there is a disagreement on the unit tests, the patch for Chain invalidates right away