From 7e15b7c97d2065024f822f00f5dcb7f265a6d4b7 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sun, 28 Aug 2011 15:15:42 +0000 Subject: [PATCH] Fix bug in r94995: getCanonicalUrl() doesn't append the fragment. This is correct behavior for getInternalUrl() (which the code was based on) but not for getFullUrl() (which is what I'm swapping getCanonicalUrl() in for in certain places). Was exposed by a unit test in CodeReview breaking on me when I tried to use canonical URLs in e-mail notifications. --- includes/Title.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/Title.php b/includes/Title.php index 725170c2bb..192e9ba64c 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1037,13 +1037,15 @@ class Title { * e-mail notifications. Uses $wgCanonicalServer and the * GetCanonicalURL hook. * + * NOTE: Unlike getInternalURL(), the canonical URL includes the fragment + * * @param $query string An optional query string * @param $variant string Language variant of URL (for sr, zh, ...) * @return string The URL */ public function getCanonicalURL( $query = '', $variant = false ) { global $wgCanonicalServer; - $url = $wgCanonicalServer . $this->getLocalURL( $query, $variant ); + $url = $wgCanonicalServer . $this->getLocalURL( $query, $variant ) . $this->getFragmentForURL(); wfRunHooks( 'GetCanonicalURL', array( &$this, &$url, $query ) ); return $url; } -- 2.20.1