Issues

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

Issue Type: Improvement Created: 2011-11-07T12:08:43.000+0000 Last Updated: 2012-12-18T20:08:27.000+0000 Status: Resolved Fix version(s): - 1.12.1 (18/Dec/12)

Reporter: Christer Edvartsen (cogo) Assignee: Ben Scholzen (dasprid) Tags: - Zend_Controller_Router

  • FixForZF1.12
  • state:patch-ready-for-review
  • zf-crteam-review

Related issues: Attachments: - ZF-11874.patch

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)

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts