ZF-11874: Inform routes in a chain wether they are the last route in the chain or not


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.


Reassigned to component maintainer.

@[~cogo]: Could you please provide a patch which can be reviewed prior to commiting to SVN?

Patch that implements the idea mentioned in the description of this ticket.

Adam: I just attached the patch. Sorry for taking so long.

Applied patch to trunk (25070) and release-1.2 (25071)