mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-30 21:52:59 +00:00
fixes #4874, duplicate base when url is empty
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7186 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
069fb0011c
commit
df2be46b00
2 changed files with 19 additions and 4 deletions
cake
|
@ -871,7 +871,7 @@ class Router extends Object {
|
||||||
if (!isset($path['here'])) {
|
if (!isset($path['here'])) {
|
||||||
$path['here'] = '/';
|
$path['here'] = '/';
|
||||||
}
|
}
|
||||||
$output = $base . $path['here'];
|
$output = $path['here'];
|
||||||
} elseif (substr($url, 0, 1) == '/') {
|
} elseif (substr($url, 0, 1) == '/') {
|
||||||
$output = $base . $url;
|
$output = $base . $url;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -256,6 +256,21 @@ class RouterTest extends UnitTestCase {
|
||||||
function testUrlGeneration() {
|
function testUrlGeneration() {
|
||||||
extract(Router::getNamedExpressions());
|
extract(Router::getNamedExpressions());
|
||||||
|
|
||||||
|
Router::setRequestInfo(array(
|
||||||
|
array(
|
||||||
|
'pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'subscribe',
|
||||||
|
'admin' => true, 'url' => array('url' => '')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'base' => '/magazine', 'here' => '/magazine',
|
||||||
|
'webroot' => '/magazine/', 'passedArgs' => array('page' => 2), 'namedArgs' => array('page' => 2),
|
||||||
|
)
|
||||||
|
));
|
||||||
|
$result = Router::url();
|
||||||
|
$this->assertEqual('/magazine', $result);
|
||||||
|
|
||||||
|
Router::reload();
|
||||||
|
|
||||||
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
|
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||||
$out = Router::url(array('controller' => 'pages', 'action' => 'display', 'home'));
|
$out = Router::url(array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||||
$this->assertEqual($out, '/');
|
$this->assertEqual($out, '/');
|
||||||
|
|
Loading…
Add table
Reference in a new issue