mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Fix issue with dots in request URLs.
Dots in request url's often resulted in an additional get parameter being added. Fixes #2303
This commit is contained in:
parent
6f285224ae
commit
390db7beba
2 changed files with 16 additions and 1 deletions
|
@ -184,7 +184,7 @@ class CakeRequest implements ArrayAccess {
|
|||
$query = $_GET;
|
||||
}
|
||||
|
||||
unset($query['/' . $this->url]);
|
||||
unset($query['/' . str_replace('.', '_', $this->url)]);
|
||||
if (strpos($this->url, '?') !== false) {
|
||||
list(, $querystr) = explode('?', $this->url);
|
||||
parse_str($querystr, $queryArgs);
|
||||
|
|
|
@ -1056,6 +1056,21 @@ class CakeRequestTest extends CakeTestCase {
|
|||
$this->assertEquals('/', $request->webroot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that a request with a . in the main GET parameter is filtered out.
|
||||
* PHP changes GET parameter keys containing dots to _.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetParamsWithDot() {
|
||||
$_GET['/posts/index/add_add'] = '';
|
||||
$_SERVER['SCRIPT_NAME'] = '/cake_dev/app/webroot/index.php';
|
||||
$_SERVER['REQUEST_URI'] = '/cake_dev/posts/index/add.add';
|
||||
|
||||
$request = new CakeRequest();
|
||||
$this->assertEquals(array(), $request->query);
|
||||
}
|
||||
|
||||
/**
|
||||
* generator for environment configurations
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue