Merge pull request #4076 from rchavik/2.5-space-in-url

Fix: Blackholed request when POSTing to a URL with space
This commit is contained in:
José Lorenzo Rodríguez 2014-07-24 12:53:04 +02:00
commit 94b9bf807b
2 changed files with 15 additions and 1 deletions

View file

@ -207,7 +207,7 @@ class CakeRequest implements ArrayAccess {
$query = $_GET;
}
$unsetUrl = '/' . str_replace('.', '_', urldecode($this->url));
$unsetUrl = '/' . str_replace(array('.', ' '), '_', urldecode($this->url));
unset($query[$unsetUrl]);
unset($query[$this->base . $unsetUrl]);
if (strpos($this->url, '?') !== false) {

View file

@ -2144,6 +2144,20 @@ class CakeRequestTest extends CakeTestCase {
$this->assertEquals('/posts/base_path/1/name:value?test=value', $result);
}
/**
* Test the here() with space in URL
*
* @return void
*/
public function testHereWithSpaceInUrl() {
Configure::write('App.base', '');
$_GET = array('/admin/settings/settings/prefix/Access_Control' => '');
$request = new CakeRequest('/admin/settings/settings/prefix/Access%20Control');
$result = $request->here();
$this->assertEquals('/admin/settings/settings/prefix/Access%20Control', $result);
}
/**
* Test the input() method.
*