mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
ff340d33ce
commit
52318f9d17
2 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue