ZF-3219: Issue regarding similiar routes
I have experienced a problem regarding similar Zend_Controller_Router_Route routes. Lets say we have an array of routes that look like this:
array( 'newsShow' => new Zend_Controller_Router_Route('news/:id/:title', array('controller' => 'news', 'action' => 'show', 'id' => null, 'title' => null), array('id' => '\d+', 'title' => '^[a-zA-Z0-9_]+$')), 'rssNewsComments' => new Zend_Controller_Router_Route('news/:id/comments/rss', array('module' => 'rss', 'controller' => 'rss', 'action' => 'news-comments', 'id' => null), array('id' => '\d+')) );
As you can see the two routes are pretty similar. This causes a problem if the dispatcher check against the rss route before the other one. The reason is that the match method changes the route values as it goes along, and when it finds out that the current route does not match anyway it does not reset the values.
Now, this is not a big problem, except when you forget to set the values using the url helper. This is how I found out about this "problem".
When doing<?= $this->url(array(), 'rssNewsComments') ?>
in my view the :id part of the rssNewsComments route is set even if I forgot to specify it in the array. This is because I am currently on the 'newsShow' page and the dispatcher changed the rssNewsComments route when looking for the current route. Normally this would result in an error telling me that "id is not specified".
I have a fix ready if you think this is a problem worth fixing.