cakephp/cakephp — pull request #2989 by mikegibson (2014-03-10 10:38:31+00:00)
Title: Fixed incorrect matching of named 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 /widgetsPart when it should give /widget/2

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