Skip to content

Commit

Permalink
fixing preg error in Router::normalize cause by last commit
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7984 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
gwoo committed Jan 14, 2009
1 parent 6c243e1 commit 6026e75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/libs/router.php
Expand Up @@ -1179,7 +1179,7 @@ function normalize($url = '/') {
$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;

Expand Down
6 changes: 6 additions & 0 deletions cake/tests/cases/libs/router.test.php
Expand Up @@ -271,6 +271,12 @@ function testUrlNormalization() {
$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
Expand Down

0 comments on commit 6026e75

Please sign in to comment.