Correcting handling of empty URLs with full base, fixes #4470

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6750 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-05-04 04:34:29 +00:00
parent f75da65bda
commit b9cfc9ecf3
2 changed files with 6 additions and 2 deletions

View file

@ -31,7 +31,7 @@
* *
*/ */
if (!class_exists('Object')) { if (!class_exists('Object')) {
uses('object'); App::import('Core', 'Object');
} }
/** /**
@ -825,7 +825,10 @@ class Router extends Object {
return $url; return $url;
} }
if (empty($url)) { if (empty($url)) {
return $path['here']; if (!isset($path['here'])) {
$path['here'] = '/';
}
$output = $base . $path['here'];
} elseif (substr($url, 0, 1) == '/') { } elseif (substr($url, 0, 1) == '/') {
$output = $base . $url; $output = $base . $url;
} else { } else {

View file

@ -52,6 +52,7 @@ class RouterTest extends UnitTestCase {
function testFullBaseURL() { function testFullBaseURL() {
$this->assertPattern('/^http(s)?:\/\//', Router::url('/', true)); $this->assertPattern('/^http(s)?:\/\//', Router::url('/', true));
$this->assertPattern('/^http(s)?:\/\//', Router::url(null, true));
} }
function testRouteWriting() { function testRouteWriting() {