mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Corrects handling of fully-qualified URLs in Router::normalize(), fixes #4036
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7363 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
6add903d84
commit
4451c02b1c
2 changed files with 11 additions and 0 deletions
|
@ -1151,6 +1151,8 @@ class Router extends Object {
|
|||
function normalize($url = '/') {
|
||||
if (is_array($url)) {
|
||||
$url = Router::url($url);
|
||||
} elseif (preg_match('/^[a-z\-]+:\/\//', $url)) {
|
||||
return $url;
|
||||
}
|
||||
$paths = Router::getPaths();
|
||||
|
||||
|
|
|
@ -246,6 +246,15 @@ class RouterTest extends CakeTestCase {
|
|||
|
||||
$result = Router::normalize('/');
|
||||
$this->assertEqual($result, '/');
|
||||
|
||||
$result = Router::normalize('http://google.com/');
|
||||
$this->assertEqual($result, 'http://google.com/');
|
||||
|
||||
$result = Router::normalize('http://google.com//');
|
||||
$this->assertEqual($result, 'http://google.com//');
|
||||
|
||||
$result = Router::normalize('/users/login/scope://foo');
|
||||
$this->assertEqual($result, '/users/login/scope:/foo');
|
||||
}
|
||||
/**
|
||||
* testUrlGeneration method
|
||||
|
|
Loading…
Reference in a new issue