Permalink
Browse files

Fix issue with dots in request URLs.

Dots in request url's often resulted in an additional get parameter
being added.

Fixes #2303
  • Loading branch information...
markstory committed Nov 27, 2011
1 parent 6f28522 commit 390db7beba59c0a070e1b0764768cad4c5059100
Showing with 16 additions and 1 deletion.
  1. +1 −1 lib/Cake/Network/CakeRequest.php
  2. +15 −0 lib/Cake/Test/Case/Network/CakeRequestTest.php
@@ -184,7 +184,7 @@ protected function _processGet() {
$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 @@ public function testBaseUrlNoRewriteWebrootIndex() {
$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
*

0 comments on commit 390db7b

Please sign in to comment.