Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix ticket 3400: url string with # in it is not routed

  • Loading branch information...
commit 94a17d40da84b02ac0cd890a2f54e9656674ccb9 1 parent 739982a
@Schlaefer Schlaefer authored
View
2  lib/Cake/Routing/Router.php
@@ -851,7 +851,7 @@ public static function url($url = null, $full = false) {
$output = self::_handleNoRoute($url);
}
} else {
- if (preg_match('/:\/\/|^(javascript|mailto|tel|sms):|\#/i', $url)) {
+ if (preg_match('/:\/\/|^(javascript|mailto|tel|sms):|^\#/i', $url)) {
return $url;
}
if (substr($url, 0, 1) === '/') {
View
6 lib/Cake/Test/Case/Routing/RouterTest.php
@@ -2540,6 +2540,12 @@ public function testUrlProtocol() {
$url = 'sms:012345-678';
$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));
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.