Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed comparison method

  • Loading branch information...
commit 5e896aa94ae736350add2ac902dace0a8ad42997 1 parent 1202658
Mike Gibson authored
Showing with 3 additions and 14 deletions.
  1. +3 −14 lib/Cake/Routing/Route/CakeRoute.php
View
17 lib/Cake/Routing/Route/CakeRoute.php
@@ -518,10 +518,10 @@ protected function _writeUrl($params) {
$out = $this->template;
$search = $replace = array();
- $keys = $this->keys;
- // Sort the keys in reverse order by length to prevent mismatches
- uasort($keys, array($this, '_sortKeys'));
+ $lengths = array_map('strlen', $this->keys);
+ $keys = array_combine($lengths, $this->keys);
+ krsort($keys);
foreach ($keys as $key) {
$string = null;
@@ -542,15 +542,4 @@ protected function _writeUrl($params) {
return $out;
}
- /**
- * Comparison method for sorting keys in reverse order by length.
- *
- * @param $a
- * @param $b
- * @return int
- */
- protected function _sortKeys($a, $b) {
- return strlen($a) > strlen($b) ? -1 : 1;
- }
-
}
Please sign in to comment.
Something went wrong with that request. Please try again.