Issues

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

Issue Type: Bug Created: 2009-11-30T08:41:43.000+0000 Last Updated: 2011-05-20T09:46:53.000+0000 Status: Open Fix version(s): Reporter: Ismo Toijala (itoijala) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Controller

Related issues: Attachments:

Description

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

<pre class="highlight">
$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

Posted by Edward Surov (zooh) on 2009-12-16T14:20:22.000+0000

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

Posted by Ismo Toijala (itoijala) on 2009-12-16T22:47:57.000+0000

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.

Posted by Victor Gryshko (hohol) on 2011-05-20T09:46:53.000+0000

To fix this you have to change the following:

<pre class="highlight">
$matchedPath = $route->getMatchedPath();

with the following:

<pre class="highlight">
$matchedPath = $route->getMatchedPath();

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

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