ZF-11874: Inform routes in a chain wether they are the last route in the chain or not
Description
If you have a chain of custom routes there is no way for the specific routes to know whether they are the last route in the chain or not during matching. We do some validation in custom routes in the chain, but this should only be done if the route doing the validation is the last in the chain.
This can be fixed with a small change to Zend_Controller_Router_Route_Chain::match():
{{$res = $route->match($match, true);}}
can be changed to:
{{$res = $route->match($match, true, ($key == $numRoutes - 1));}}
where {{$numRoutes}} is {{count($this->_routes)}}.
Routes wanting to use this information can expand the signature to {{match()}} in the custom route classes.
I have commit rights and have a working copy with attached tests and can commit if the feature is accepted.
Comments
Posted by Adam Lundrigan (adamlundrigan) on 2011-11-30T17:45:10.000+0000
Reassigned to component maintainer.
@[~cogo]: Could you please provide a patch which can be reviewed prior to commiting to SVN?
Posted by Christer Edvartsen (cogo) on 2012-01-06T09:53:30.000+0000
Patch that implements the idea mentioned in the description of this ticket.
Posted by Christer Edvartsen (cogo) on 2012-01-06T09:54:58.000+0000
Adam: I just attached the patch. Sorry for taking so long.
Posted by Rob Allen (rob) on 2012-11-06T19:07:11.000+0000
Applied patch to trunk (25070) and release-1.2 (25071)