mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #2709 from MelvinRoss/url-fix
Fix double url decoding bug
This commit is contained in:
commit
82aa048acc
1 changed files with 6 additions and 6 deletions
|
@ -235,7 +235,7 @@ class CakeRoute {
|
||||||
|
|
||||||
foreach ($this->keys as $key) {
|
foreach ($this->keys as $key) {
|
||||||
if (isset($route[$key])) {
|
if (isset($route[$key])) {
|
||||||
$route[$key] = rawurldecode($route[$key]);
|
$route[$key] = $route[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ class CakeRoute {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($route['_trailing_'])) {
|
if (isset($route['_trailing_'])) {
|
||||||
$route['pass'][] = rawurldecode($route['_trailing_']);
|
$route['pass'][] = $route['_trailing_'];
|
||||||
unset($route['_trailing_']);
|
unset($route['_trailing_']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,12 +297,12 @@ class CakeRoute {
|
||||||
$separatorIsPresent = strpos($param, $namedConfig['separator']) !== false;
|
$separatorIsPresent = strpos($param, $namedConfig['separator']) !== false;
|
||||||
if ((!isset($this->options['named']) || !empty($this->options['named'])) && $separatorIsPresent) {
|
if ((!isset($this->options['named']) || !empty($this->options['named'])) && $separatorIsPresent) {
|
||||||
list($key, $val) = explode($namedConfig['separator'], $param, 2);
|
list($key, $val) = explode($namedConfig['separator'], $param, 2);
|
||||||
$key = rawurldecode($key);
|
$key = $key;
|
||||||
$val = rawurldecode($val);
|
$val = $val;
|
||||||
$hasRule = isset($rules[$key]);
|
$hasRule = isset($rules[$key]);
|
||||||
$passIt = (!$hasRule && !$greedy) || ($hasRule && !$this->_matchNamed($val, $rules[$key], $context));
|
$passIt = (!$hasRule && !$greedy) || ($hasRule && !$this->_matchNamed($val, $rules[$key], $context));
|
||||||
if ($passIt) {
|
if ($passIt) {
|
||||||
$pass[] = rawurldecode($param);
|
$pass[] = $param;
|
||||||
} else {
|
} else {
|
||||||
if (preg_match_all('/\[([A-Za-z0-9_-]+)?\]/', $key, $matches, PREG_SET_ORDER)) {
|
if (preg_match_all('/\[([A-Za-z0-9_-]+)?\]/', $key, $matches, PREG_SET_ORDER)) {
|
||||||
$matches = array_reverse($matches);
|
$matches = array_reverse($matches);
|
||||||
|
@ -323,7 +323,7 @@ class CakeRoute {
|
||||||
$named = array_merge_recursive($named, array($key => $val));
|
$named = array_merge_recursive($named, array($key => $val));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$pass[] = rawurldecode($param);
|
$pass[] = $param;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return array($pass, $named);
|
return array($pass, $named);
|
||||||
|
|
Loading…
Reference in a new issue