Permalink
Browse files

All tests passing in RouterTest.

  • Loading branch information...
1 parent e741e0e commit 02ed7668749cbce130b73355de9ca731450d2900 @markstory markstory committed Dec 2, 2009
Showing with 5 additions and 10 deletions.
  1. +5 −10 cake/libs/router.php
View
@@ -756,11 +756,7 @@ function url($url = null, $full = false) {
}
$backupUrl = $url;
- //$url += array('controller' => $params['controller'], 'plugin' => $params['plugin'])
- $url = array_merge(
- array('controller' => $params['controller'], 'plugin' => $params['plugin']),
- Set::filter($url, true)
- );
+ $url += array('controller' => $params['controller'], 'plugin' => $params['plugin']);
if (isset($url['ext'])) {
$extension = '.' . $url['ext'];
@@ -1359,16 +1355,15 @@ function match($url) {
$defaults = $this->defaults;
if (isset($defaults['prefix'])) {
- $prefix = $defaults['prefix'];
- unset($defaults['prefix']);
+ $url['prefix'] = $defaults['prefix'];
}
//check that all the key names are in the url
$keyNames = array_flip($this->keys);
if (array_intersect_key($keyNames, $url) != $keyNames) {
return false;
}
- $diff = Set::diff($url, $defaults);
+ $diff = Set::filter(Set::diff($url, $defaults), true);
//if a not a greedy route, no extra params are allowed.
if (!$this->_greedy && array_diff_key($diff, $keyNames) != array()) {
@@ -1382,7 +1377,7 @@ function match($url) {
}
$filteredDefaults = array_filter($defaults);
- //if the difference between the url and defaults contains keys from defaults its not a match
+ //if the difference between the url diff and defaults contains keys from defaults its not a match
if (array_intersect_key($filteredDefaults, $diff) !== array()) {
return false;
}
@@ -1424,7 +1419,7 @@ function match($url) {
}
}
}
- return $this->_writeUrl(array_merge($url, compact('pass', 'named', 'prefix')));
+ return $this->_writeUrl(array_merge($url, compact('pass', 'named')));
}
/**
* Converts a matching route array into a url string.

0 comments on commit 02ed766

Please sign in to comment.