mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixing a failing test.
This commit is contained in:
parent
21dd7fd4ca
commit
e36631091d
1 changed files with 9 additions and 2 deletions
|
@ -756,6 +756,7 @@ class Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
$backupUrl = $url;
|
$backupUrl = $url;
|
||||||
|
//$url += array('controller' => $params['controller'], 'plugin' => $params['plugin'])
|
||||||
$url = array_merge(
|
$url = array_merge(
|
||||||
array('controller' => $params['controller'], 'plugin' => $params['plugin']),
|
array('controller' => $params['controller'], 'plugin' => $params['plugin']),
|
||||||
Set::filter($url, true)
|
Set::filter($url, true)
|
||||||
|
@ -1374,6 +1375,7 @@ class RouterRoute {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//remove defaults that are also keys. They can cause match failures
|
||||||
$count = count($this->keys);
|
$count = count($this->keys);
|
||||||
while ($count--) {
|
while ($count--) {
|
||||||
unset($defaults[$this->keys[$count]]);
|
unset($defaults[$this->keys[$count]]);
|
||||||
|
@ -1392,7 +1394,7 @@ class RouterRoute {
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$passedArgsAndParams = array_diff_key($diff, $defaults, $keyNames);
|
$passedArgsAndParams = array_diff_key($diff, array_filter($defaults), $keyNames);
|
||||||
list($named, $params) = Router::getNamedElements($passedArgsAndParams, $url['controller'], $url['action']);
|
list($named, $params) = Router::getNamedElements($passedArgsAndParams, $url['controller'], $url['action']);
|
||||||
|
|
||||||
//remove any pass params, they have numeric indexes, skip any params that are in the defaults
|
//remove any pass params, they have numeric indexes, skip any params that are in the defaults
|
||||||
|
@ -1407,7 +1409,12 @@ class RouterRoute {
|
||||||
unset($url[$i], $params[$i]);
|
unset($url[$i], $params[$i]);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//still some left over parameters that weren't named or passed args, bail.
|
||||||
|
if (!empty($params)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//check patterns for routed params
|
//check patterns for routed params
|
||||||
if (!empty($this->params)) {
|
if (!empty($this->params)) {
|
||||||
foreach ($this->params as $key => $pattern) {
|
foreach ($this->params as $key => $pattern) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue