cakephp/cakephp — pull request #2991 by mikegibson (2014-03-10 11:46:05+00:00)
Title: Fixed incorrect replacement of route elements beginning with same string

Where a route contains a named element which starts with the name of a previous named element, the router is matching these incorrectly.

For example:
```
Router::connect('/:product/:productsPart', array('controller' => 'products', 'action' => 'view'));
echo Router::url(array('controller' => 'products', 'action' => 'view', 'product' => 'widget', 'productsPart' => 2));
```
gives /widget/widgetsPart when it should give /widget/2

I have fixed this by simply ordering the params in reverse length order before checking for matches.