fixing preg error in Router::normalize cause by last commit

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7984 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2009-01-14 18:27:14 +00:00
parent 6c243e1106
commit 6026e75009
2 changed files with 7 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 = preg_replace("/{$paths['base']}/", '', $url, 1);
$url = preg_replace('/' . preg_quote($paths['base'], '/') . '/', '', $url, 1);
}
$url = '/' . $url;

View file

@ -271,6 +271,12 @@ class RouterTest extends CakeTestCase {
$result = Router::normalize('/us/users/logout/');
$this->assertEqual($result, '/users/logout');
Router::reload();
Router::setRequestInfo(array(array(), array('base' => '/cake_12')));
$result = Router::normalize('/cake_12/users/logout/');
$this->assertEqual($result, '/users/logout');
}
/**
* testUrlGeneration method