mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
f75da65bda
commit
b9cfc9ecf3
2 changed files with 6 additions and 2 deletions
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
*/
|
||||
if (!class_exists('Object')) {
|
||||
uses('object');
|
||||
App::import('Core', 'Object');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -825,7 +825,10 @@ class Router extends Object {
|
|||
return $url;
|
||||
}
|
||||
if (empty($url)) {
|
||||
return $path['here'];
|
||||
if (!isset($path['here'])) {
|
||||
$path['here'] = '/';
|
||||
}
|
||||
$output = $base . $path['here'];
|
||||
} elseif (substr($url, 0, 1) == '/') {
|
||||
$output = $base . $url;
|
||||
} else {
|
||||
|
|
|
@ -52,6 +52,7 @@ class RouterTest extends UnitTestCase {
|
|||
|
||||
function testFullBaseURL() {
|
||||
$this->assertPattern('/^http(s)?:\/\//', Router::url('/', true));
|
||||
$this->assertPattern('/^http(s)?:\/\//', Router::url(null, true));
|
||||
}
|
||||
|
||||
function testRouteWriting() {
|
||||
|
|
Loading…
Reference in a new issue