mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
A fixing Dispatcher handling for GET vars when request is made from domain base, fixes #3856
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6442 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5770e95fc9
commit
bb879da388
2 changed files with 16 additions and 2 deletions
|
@ -566,9 +566,11 @@ class Dispatcher extends Object {
|
|||
if ($base) {
|
||||
$uri = preg_replace('/^(?:\/)?(?:' . preg_quote($base, '/') . ')?(?:url=)?/', '', $uri);
|
||||
}
|
||||
$uri = preg_replace('/^(?:\/)?(?:index\.php)?(?:\/)?(?:\?)?(?:url=)?/', '', $uri);
|
||||
|
||||
if (Configure::read('App.server') == 'IIS' && !empty($uri)) {
|
||||
if (Configure::read('App.server') == 'IIS') {
|
||||
$uri = preg_replace('/^(?:\/)?(?:\/)?(?:\?)?(?:url=)?/', '', $uri);
|
||||
}
|
||||
if (!empty($uri)) {
|
||||
if (key($_GET) && strpos(key($_GET), '?') !== false) {
|
||||
unset($_GET[key($_GET)]);
|
||||
}
|
||||
|
|
|
@ -1082,6 +1082,15 @@ class DispatcherTest extends UnitTestCase {
|
|||
'SERVER' => array('UNIQUE_ID' => 'VardGqn@17IAAAu7LY8AAAAK', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-us) AppleWebKit/523.10.5 (KHTML, like Gecko) Version/3.0.4 Safari/523.10.6', 'HTTP_ACCEPT' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_LANGUAGE' => 'en-us', 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 'HTTP_CONNECTION' => 'keep-alive', 'HTTP_HOST' => 'localhost', 'DOCUMENT_ROOT' => '/Library/WebServer/Documents/officespace/app/webroot', 'SCRIPT_FILENAME' => '/Library/WebServer/Documents/officespace/app/webroot/index.php', 'QUERY_STRING' => '', 'REQUEST_URI' => '/index.php/posts/add', 'SCRIPT_NAME' => '/index.php', 'PATH_INFO' => '/posts/add', 'PHP_SELF' => '/index.php/posts/add', 'argv' => array(), 'argc' => 0),
|
||||
'reload' => false,
|
||||
'path' => '/posts/add'
|
||||
),
|
||||
'GET Request at base domain' => array(
|
||||
'App' => array('base' => false, 'baseUrl' => null, 'dir' => 'app', 'webroot' => 'webroot'),
|
||||
'SERVER' => array('UNIQUE_ID' => '2A-v8sCoAQ8AAAc-2xUAAAAB', 'HTTP_ACCEPT_LANGUAGE' => 'en-us', 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 'HTTP_COOKIE' => 'CAKEPHP=jcbv51apn84kd9ucv5aj2ln3t3', 'HTTP_CONNECTION' => 'keep-alive', 'HTTP_HOST' => 'cake.1.2', 'SERVER_NAME' => 'cake.1.2', 'SERVER_ADDR' => '127.0.0.1', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '127.0.0.1', 'DOCUMENT_ROOT' => '/Volumes/Home/htdocs/cake/repo/branches/1.2.x.x/app/webroot', 'SERVER_ADMIN' => 'you@example.com', 'SCRIPT_FILENAME' => '/Volumes/Home/htdocs/cake/repo/branches/1.2.x.x/app/webroot/index.php', 'REMOTE_PORT' => '53550', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => 'a=b', 'REQUEST_URI' => '/?a=b', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php'),
|
||||
'GET' => array('a' => 'b'),
|
||||
'POST' => array(),
|
||||
'reload' => true,
|
||||
'path' => '',
|
||||
'urlParams' => array('a' => 'b')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -1094,6 +1103,9 @@ class DispatcherTest extends UnitTestCase {
|
|||
}
|
||||
$this->__loadEnvironment($settings);
|
||||
$this->assertEqual($dispatcher->uri(), $settings['path'], "%s on environment: {$name}, on setting: {$descrip}");
|
||||
if (isset($setting['urlParams'])) {
|
||||
$this->assertEqual($_GET, $settings['urlParams'], "%s on environment: {$name}, on setting: {$descrip}");
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->__loadEnvironment(array_merge(array('reload' => true), $backup));
|
||||
|
|
Loading…
Add table
Reference in a new issue