mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.0' into 2.1
This commit is contained in:
commit
20229eeb43
4 changed files with 44 additions and 2 deletions
|
@ -185,7 +185,7 @@ class CakeRequest implements ArrayAccess {
|
|||
$query = $_GET;
|
||||
}
|
||||
|
||||
unset($query['/' . str_replace('.', '_', $this->url)]);
|
||||
unset($query['/' . str_replace('.', '_', urldecode($this->url))]);
|
||||
if (strpos($this->url, '?') !== false) {
|
||||
list(, $querystr) = explode('?', $this->url);
|
||||
parse_str($querystr, $queryArgs);
|
||||
|
|
|
@ -225,7 +225,13 @@ class CakeRoute {
|
|||
}
|
||||
$route[$key] = $value;
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->keys as $key) {
|
||||
if (isset($route[$key])) {
|
||||
$route[$key] = rawurldecode($route[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($route['_args_'])) {
|
||||
list($pass, $named) = $this->_parseArgs($route['_args_'], $route);
|
||||
$route['pass'] = array_merge($route['pass'], $pass);
|
||||
|
|
|
@ -1120,6 +1120,20 @@ class CakeRequestTest extends CakeTestCase {
|
|||
$this->assertEquals(array(), $request->query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that a request with urlencoded bits in the main GET parameter are filtered out.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetParamWithUrlencodedElement() {
|
||||
$_GET['/posts/add/∂∂'] = '';
|
||||
$_SERVER['PHP_SELF'] = '/cake_dev/app/webroot/index.php';
|
||||
$_SERVER['REQUEST_URI'] = '/cake_dev/posts/add/%E2%88%82%E2%88%82';
|
||||
|
||||
$request = new CakeRequest();
|
||||
$this->assertEquals(array(), $request->query);
|
||||
}
|
||||
|
||||
/**
|
||||
* generator for environment configurations
|
||||
*
|
||||
|
|
|
@ -508,6 +508,28 @@ class CakeRouteTest extends CakeTestCase {
|
|||
$this->assertEquals($result['action'], 'index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that :key elements are urldecoded
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testParseUrlDecodeElements() {
|
||||
$route = new Cakeroute(
|
||||
'/:controller/:slug',
|
||||
array('action' => 'view')
|
||||
);
|
||||
$route->compile();
|
||||
$result = $route->parse('/posts/%E2%88%82%E2%88%82');
|
||||
$this->assertEquals($result['controller'], 'posts');
|
||||
$this->assertEquals($result['action'], 'view');
|
||||
$this->assertEquals($result['slug'], '∂∂');
|
||||
|
||||
$result = $route->parse('/posts/∂∂');
|
||||
$this->assertEquals($result['controller'], 'posts');
|
||||
$this->assertEquals($result['action'], 'view');
|
||||
$this->assertEquals($result['slug'], '∂∂');
|
||||
}
|
||||
|
||||
/**
|
||||
* test numerically indexed defaults, get appeneded to pass
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue