Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removing routing url from query string in CakeRequest. This happens m…

…ostly with nginx setups
  • Loading branch information...
commit f94394f582e4a2c83e4376f6b4c643b8dc041438 1 parent 7d0250f
José Lorenzo Rodríguez lorenzo authored
1  lib/Cake/Network/CakeRequest.php
View
@@ -180,6 +180,7 @@ protected function _processGet() {
$query = $_GET;
}
+ unset($query['/' . $this->url]);
if (strpos($this->url, '?') !== false) {
list(, $querystr) = explode('?', $this->url);
parse_str($querystr, $queryArgs);
30 lib/Cake/Test/Case/Network/CakeRequestTest.php
View
@@ -1325,6 +1325,34 @@ public static function environmentGenerator() {
'webroot' => '/',
),
),
+ array(
+ 'Nginx - w/rewrite, document root set to webroot, request root, no PATH_INFO',
+ array(
+ 'App' => array(
+ 'base' => false,
+ 'baseUrl' => false,
+ 'dir' => 'app',
+ 'webroot' => 'webroot'
+ ),
+ 'GET' => array('/posts/add' => ''),
+ 'SERVER' => array(
+ 'SERVER_NAME' => 'localhost',
+ 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/site/app/webroot',
+ 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/site/app/webroot/index.php',
+ 'SCRIPT_NAME' => '/index.php',
+ 'QUERY_STRING' => '/posts/add&',
+ 'PHP_SELF' => '/index.php',
+ 'PATH_INFO' => null,
+ 'REQUEST_URI' => '/posts/add',
+ ),
+ ),
+ array(
+ 'url' => 'posts/add',
+ 'base' => '',
+ 'webroot' => '/',
+ 'urlParams' => array()
+ ),
+ ),
);
}
@@ -1343,7 +1371,7 @@ public function testEnvironmentDetection($name, $env, $expected) {
$this->assertEquals($expected['base'], $request->base, "base error");
$this->assertEquals($expected['webroot'], $request->webroot, "webroot error");
if (isset($expected['urlParams'])) {
- $this->assertEqual($_GET, $expected['urlParams'], "GET param mismatch");
+ $this->assertEqual($request->query, $expected['urlParams'], "GET param mismatch");
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.