fixes #5978, Router::normalize url generation

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7981 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2009-01-14 17:55:48 +00:00
parent ff340d33ce
commit 52318f9d17
2 changed files with 6 additions and 1 deletions

View file

@ -1179,7 +1179,7 @@ class Router extends Object {
$paths = Router::getPaths();
if (!empty($paths['base']) && stristr($url, $paths['base'])) {
$url = str_replace($paths['base'], '', $url);
$url = preg_replace("/{$paths['base']}/", '', $url, 1);
}
$url = '/' . $url;

View file

@ -266,6 +266,11 @@ class RouterTest extends CakeTestCase {
$result = Router::normalize('/recipe/recipes/add');
$this->assertEqual($result, '/recipe/recipes/add');
Router::setRequestInfo(array(array(), array('base' => 'us')));
$result = Router::normalize('/us/users/logout/');
$this->assertEqual($result, '/users/logout');
}
/**
* testUrlGeneration method