mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add missing rawurlencode()
When routes fail to match because of unknown named parameters, values that needed urlencoding were missing it. Fixes #2572
This commit is contained in:
parent
afecb713ab
commit
76711c9f71
2 changed files with 6 additions and 4 deletions
|
@ -917,7 +917,7 @@ class Router {
|
|||
$output = implode('/', $urlOut);
|
||||
|
||||
if (!empty($args)) {
|
||||
$output .= '/' . implode('/', $args);
|
||||
$output .= '/' . implode('/', array_map('rawurlencode', $args));
|
||||
}
|
||||
|
||||
if (!empty($named)) {
|
||||
|
@ -925,10 +925,10 @@ class Router {
|
|||
if (is_array($value)) {
|
||||
$flattend = Set::flatten($value, '][');
|
||||
foreach ($flattend as $namedKey => $namedValue) {
|
||||
$output .= '/' . $name . "[$namedKey]" . self::$_namedConfig['separator'] . $namedValue;
|
||||
$output .= '/' . $name . "[$namedKey]" . self::$_namedConfig['separator'] . rawurlencode($namedValue);
|
||||
}
|
||||
} else {
|
||||
$output .= '/' . $name . self::$_namedConfig['separator'] . $value;
|
||||
$output .= '/' . $name . self::$_namedConfig['separator'] . rawurlencode($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ class RouterTest extends CakeTestCase {
|
|||
'keyed' => 'is an array',
|
||||
'test'
|
||||
)));
|
||||
$expected = '/tests/index/namedParam[keyed]:is an array/namedParam[0]:test';
|
||||
$expected = '/tests/index/namedParam[keyed]:is%20an%20array/namedParam[0]:test';
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
|
@ -1705,6 +1705,8 @@ class RouterTest extends CakeTestCase {
|
|||
*/
|
||||
public function testPrefixFalseIgnored() {
|
||||
Configure::write('Routing.prefixes', array('admin'));
|
||||
Router::reload();
|
||||
|
||||
Router::connect('/cache_css/*', array('admin' => false, 'controller' => 'asset_compress', 'action' => 'get'));
|
||||
|
||||
$url = Router::url(array('controller' => 'asset_compress', 'action' => 'get', 'test'));
|
||||
|
|
Loading…
Reference in a new issue