Skip to content

Commit

Permalink
Fix Router::url() in 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gold1 committed Aug 3, 2013
1 parent a8d5052 commit cc1de6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 1 addition & 5 deletions lib/Cake/Routing/Router.php
Expand Up @@ -800,11 +800,7 @@ public static function url($url = null, $options = array()) {
if ($plainString) {
return $url;
}
$output = $url;
if ($hasLeadingSlash && strlen($output) > 1) {
$output = substr($output, 1);
}
$output = $base . $output;
$output = $base . $url;
}
$protocol = preg_match('#^[a-z][a-z0-9+\-.]*\://#i', $output);
if ($protocol === 0) {
Expand Down
6 changes: 6 additions & 0 deletions lib/Cake/Test/TestCase/Routing/RouterTest.php
Expand Up @@ -411,6 +411,12 @@ public function testUrlGenerationWithBasePath() {
$result = Router::url('/');
$this->assertEquals('/magazine/', $result);

$result = Router::url('/articles/');
$this->assertEquals('/magazine/articles/', $result);

$result = Router::url('/articles/view');
$this->assertEquals('/magazine/articles/view', $result);

$result = Router::url(['controller' => 'articles', 'action' => 'view', 1]);
$this->assertEquals('/magazine/articles/view/1', $result);
}
Expand Down

0 comments on commit cc1de6c

Please sign in to comment.