From: Roan Kattouw Date: Sun, 28 Aug 2011 15:15:42 +0000 (+0000) Subject: Fix bug in r94995: getCanonicalUrl() doesn't append the fragment. This is correct... X-Git-Tag: 1.31.0-rc.0~28037 X-Git-Url: http://git.cyclocoop.org//%27http:/code.google.com/p/ie7-js//%27?a=commitdiff_plain;h=7e15b7c97d2065024f822f00f5dcb7f265a6d4b7;p=lhc%2Fweb%2Fwiklou.git 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. --- 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; }