mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
updating dispatcher related to #3856, test added
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6408 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f598b58465
commit
ebeb7d0f94
2 changed files with 9 additions and 1 deletions
|
@ -605,7 +605,7 @@ class Dispatcher extends Object {
|
|||
if ($tmpUri === '/' || $tmpUri == $baseDir || $tmpUri == $base) {
|
||||
$url = $_GET['url'] = '/';
|
||||
} else {
|
||||
if (strpos($uri, $base) !== false) {
|
||||
if ($base && strpos($uri, $base) !== false) {
|
||||
$elements = explode($base, $uri);
|
||||
} elseif (preg_match('/^[\/\?\/|\/\?|\?\/]/', $uri)) {
|
||||
$elements = array(1 => preg_replace('/^[\/\?\/|\/\?|\?\/]/', '', $uri));
|
||||
|
|
|
@ -372,6 +372,14 @@ class DispatcherTest extends UnitTestCase {
|
|||
$result = $Dispatcher->getUrl($uri);
|
||||
$expected = 'students/browse';
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$_GET['url'] = array();
|
||||
$Dispatcher =& new Dispatcher();
|
||||
$Dispatcher->base = '';
|
||||
$uri = '/?/home';
|
||||
$result = $Dispatcher->getUrl($uri);
|
||||
$expected = '?/home';
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
function testBaseUrlAndWebrootWithModRewrite() {
|
||||
|
|
Loading…
Add table
Reference in a new issue