mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #1039 from bfanger/master
Fixes an issue with urls as GET parameters
This commit is contained in:
commit
acc6a2645f
2 changed files with 13 additions and 1 deletions
|
@ -232,7 +232,11 @@ class CakeRequest implements ArrayAccess {
|
||||||
} elseif (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '://') === false) {
|
} elseif (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '://') === false) {
|
||||||
$uri = $_SERVER['REQUEST_URI'];
|
$uri = $_SERVER['REQUEST_URI'];
|
||||||
} elseif (isset($_SERVER['REQUEST_URI'])) {
|
} elseif (isset($_SERVER['REQUEST_URI'])) {
|
||||||
$uri = substr($_SERVER['REQUEST_URI'], strlen(FULL_BASE_URL));
|
if (strpos($_SERVER['REQUEST_URI'], '?') !== false && strpos($_SERVER['REQUEST_URI'], '://') > strpos($_SERVER['REQUEST_URI'], '?')) {
|
||||||
|
$uri = $_SERVER['REQUEST_URI'];
|
||||||
|
} else {
|
||||||
|
$uri = substr($_SERVER['REQUEST_URI'], strlen(FULL_BASE_URL));
|
||||||
|
}
|
||||||
} elseif (isset($_SERVER['PHP_SELF']) && isset($_SERVER['SCRIPT_NAME'])) {
|
} elseif (isset($_SERVER['PHP_SELF']) && isset($_SERVER['SCRIPT_NAME'])) {
|
||||||
$uri = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['PHP_SELF']);
|
$uri = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['PHP_SELF']);
|
||||||
} elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
|
} elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
|
||||||
|
|
|
@ -136,6 +136,14 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
$_SERVER['REQUEST_URI'] = '/tasks/index/page:1/?ts=123456';
|
$_SERVER['REQUEST_URI'] = '/tasks/index/page:1/?ts=123456';
|
||||||
$request = new CakeRequest();
|
$request = new CakeRequest();
|
||||||
$this->assertEquals('tasks/index/page:1/', $request->url);
|
$this->assertEquals('tasks/index/page:1/', $request->url);
|
||||||
|
|
||||||
|
$_SERVER['REQUEST_URI'] = '/some/path?url=http://cakephp.org';
|
||||||
|
$request = new CakeRequest();
|
||||||
|
$this->assertEquals('some/path', $request->url);
|
||||||
|
|
||||||
|
$_SERVER['REQUEST_URI'] = FULL_BASE_URL.'/other/path?url=http://cakephp.org';
|
||||||
|
$request = new CakeRequest();
|
||||||
|
$this->assertEquals('other/path', $request->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue