mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding fix for #2466 fixes missed Router::__mapped reinit in Router::url()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4909 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
7cdb495068
commit
0ddac86f58
1 changed files with 5 additions and 6 deletions
|
@ -432,8 +432,8 @@ class Router extends Object {
|
|||
$params = end($_this->__params);
|
||||
}
|
||||
}
|
||||
|
||||
$path = array('base' => null);
|
||||
|
||||
if(!empty($_this->__paths)) {
|
||||
if(!isset($_this->params['requested'])) {
|
||||
$path = $_this->__paths[0];
|
||||
|
@ -441,7 +441,6 @@ class Router extends Object {
|
|||
$path = end($_this->__paths);
|
||||
}
|
||||
}
|
||||
|
||||
$base = $_this->stripPlugin($path['base'], $params['plugin']);
|
||||
$extension = $output = $mapped = $q = $frag = null;
|
||||
|
||||
|
@ -465,7 +464,6 @@ class Router extends Object {
|
|||
$url['action'] = 'index';
|
||||
}
|
||||
}
|
||||
|
||||
$url = am(array('controller' => $params['controller'], 'plugin' => $params['plugin']), $url);
|
||||
|
||||
if (isset($url['ext'])) {
|
||||
|
@ -477,8 +475,8 @@ class Router extends Object {
|
|||
} elseif (defined('CAKE_ADMIN') && isset($url[CAKE_ADMIN]) && $url[CAKE_ADMIN] == false) {
|
||||
unset($url[CAKE_ADMIN]);
|
||||
}
|
||||
|
||||
$match = false;
|
||||
|
||||
foreach ($_this->routes as $route) {
|
||||
if ($match = $_this->mapRouteElements($route, $url)) {
|
||||
list($output, $url) = $match;
|
||||
|
@ -488,15 +486,16 @@ class Router extends Object {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$named = $args = array();
|
||||
$skip = am(array_keys($_this->__mapped), array('bare', 'action', 'controller', 'plugin', 'ext', '?', '#'));
|
||||
|
||||
if(defined('CAKE_ADMIN')) {
|
||||
$skip[] = CAKE_ADMIN;
|
||||
}
|
||||
|
||||
$_this->__mapped = array();
|
||||
$keys = array_values(array_diff(array_keys($url), $skip));
|
||||
$count = count($keys);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if ($i == 0 && is_numeric($keys[$i]) && in_array('id', $keys)) {
|
||||
$args[0] = $url[$keys[$i]];
|
||||
|
|
Loading…
Reference in a new issue