diff --git a/cake/libs/router.php b/cake/libs/router.php index 3707a56d7..f0cf13e50 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -1245,7 +1245,7 @@ class Router extends Object { * @access public * @static */ - function stripPlugin($base, $plugin) { + function stripPlugin($base, $plugin = null) { if ($plugin != null) { $base = preg_replace('/(?:' . $plugin . ')/', '', $base); $base = str_replace('//', '', $base); @@ -1258,7 +1258,6 @@ class Router extends Object { } return $base; } - /** * Strip escape characters from parameter values. * diff --git a/cake/tests/cases/libs/router.test.php b/cake/tests/cases/libs/router.test.php index 08739db83..99d0e220d 100644 --- a/cake/tests/cases/libs/router.test.php +++ b/cake/tests/cases/libs/router.test.php @@ -1655,5 +1655,20 @@ class RouterTest extends CakeTestCase { $expected = '/test/test_another_action/locale:badness'; $this->assertEqual($result, $expected); } +/** + * testStripPlugin + * + * @return void + * @access public + */ + function testStripPlugin() { + $pluginName = 'forums'; + $url = 'example.com/' . $pluginName . '/'; + $expected = 'example.com'; + + $this->assertEqual(Router::stripPlugin($url, $pluginName), $expected); + $this->assertEqual(Router::stripPlugin($url), $url); + $this->assertEqual(Router::stripPlugin($url, null), $url); + } } ?> \ No newline at end of file