Issues

ZF-8428: Zend_Controller_Router_Route_Chain should call setMatchedPath($path)

Description

It is currently not possible to chain more than two routes.Example with 3 routes:


$route = new Zend_Controller_Router_Route('example', array('controller' => 'error', 'action' => 'error'));
$route2 = new Zend_Controller_Router_Route('buggy');
$route3 = new Zend_Controller_Router_Route('url');
$chain = $route->chain($route2->chain($route3));
$router->addRoute('example_route', $chain);

The route above does not match "example/buggy/url".

This is because Zend_Controller_Router_Route_Chain does not call setMatchedPath($path), meaning that the outer chain thinks that the inner chain did not match.

It seems tat this can be solved by calling $this->setMatchedPath($path) in match.

Comments

Route doesn't match because 'url' != 'route'.

Sorry about that typo. It doesn't match "example/buggy/url" either. It works if I add the line to Zend_Controller_Router_Route_Chain.

To fix this you have to change the following:


$matchedPath = $route->getMatchedPath();

with the following:


$matchedPath = $route->getMatchedPath();

$this->setMatchedPath(trim(
    (string)$this->getMatchedPath() .
    (string)$separator .
    (string)$matchedPath
), '/');