From b6fffeb0e46373c18ae8bd5fa1aef0a7b691e15b Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Thu, 16 May 2013 23:21:08 -0400 Subject: [PATCH] Removed trailing slash in created URLs. --- tests/unit/framework/web/UrlManagerTest.php | 8 ++++---- yii/web/UrlManager.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/framework/web/UrlManagerTest.php b/tests/unit/framework/web/UrlManagerTest.php index 1c522c3..ed2a70e 100644 --- a/tests/unit/framework/web/UrlManagerTest.php +++ b/tests/unit/framework/web/UrlManagerTest.php @@ -14,9 +14,9 @@ class UrlManagerTest extends \yiiunit\TestCase 'cache' => null, )); $url = $manager->createUrl('post/view'); - $this->assertEquals('/?r=post/view', $url); + $this->assertEquals('?r=post/view', $url); $url = $manager->createUrl('post/view', array('id' => 1, 'title' => 'sample post')); - $this->assertEquals('/?r=post/view&id=1&title=sample+post', $url); + $this->assertEquals('?r=post/view&id=1&title=sample+post', $url); // default setting with '/test/' as base url $manager = new UrlManager(array( @@ -24,7 +24,7 @@ class UrlManagerTest extends \yiiunit\TestCase 'cache' => null, )); $url = $manager->createUrl('post/view', array('id' => 1, 'title' => 'sample post')); - $this->assertEquals('/test/?r=post/view&id=1&title=sample+post', $url); + $this->assertEquals('/test?r=post/view&id=1&title=sample+post', $url); // pretty URL without rules $manager = new UrlManager(array( @@ -112,7 +112,7 @@ class UrlManagerTest extends \yiiunit\TestCase 'cache' => null, )); $url = $manager->createAbsoluteUrl('post/view', array('id' => 1, 'title' => 'sample post')); - $this->assertEquals('http://www.example.com/?r=post/view&id=1&title=sample+post', $url); + $this->assertEquals('http://www.example.com?r=post/view&id=1&title=sample+post', $url); } public function testParseRequest() diff --git a/yii/web/UrlManager.php b/yii/web/UrlManager.php index 7a03a93..6392d11 100644 --- a/yii/web/UrlManager.php +++ b/yii/web/UrlManager.php @@ -203,7 +203,7 @@ class UrlManager extends Component } return "$baseUrl/{$route}{$anchor}"; } else { - $url = "$baseUrl/?{$this->routeVar}=$route"; + $url = "$baseUrl?{$this->routeVar}=$route"; if (!empty($params)) { $url .= '&' . http_build_query($params); }