mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
fix ticket 3400: url string with # in it is not routed
See: http://cakephp.lighthouseapp.com/projects/42648/tickets/3400-url-string-with-in-it-is-not-routed
This commit is contained in:
parent
739982addb
commit
94a17d40da
2 changed files with 7 additions and 1 deletions
|
@ -851,7 +851,7 @@ class Router {
|
||||||
$output = self::_handleNoRoute($url);
|
$output = self::_handleNoRoute($url);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (preg_match('/:\/\/|^(javascript|mailto|tel|sms):|\#/i', $url)) {
|
if (preg_match('/:\/\/|^(javascript|mailto|tel|sms):|^\#/i', $url)) {
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
if (substr($url, 0, 1) === '/') {
|
if (substr($url, 0, 1) === '/') {
|
||||||
|
|
|
@ -2540,6 +2540,12 @@ class RouterTest extends CakeTestCase {
|
||||||
|
|
||||||
$url = 'sms:012345-678';
|
$url = 'sms:012345-678';
|
||||||
$this->assertEquals($url, Router::url($url));
|
$this->assertEquals($url, Router::url($url));
|
||||||
|
|
||||||
|
$url = '#here';
|
||||||
|
$this->assertEquals($url, Router::url($url));
|
||||||
|
$url = 'posts/index#here';
|
||||||
|
$expected = FULL_BASE_URL . '/posts/index#here';
|
||||||
|
$this->assertEquals($expected, Router::url($url, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue