From a3911e151c628bb6cb3f7d2ca46fdd548c6f643d Mon Sep 17 00:00:00 2001 From: Rotem Liss Date: Fri, 1 Aug 2008 10:15:29 +0000 Subject: [PATCH] Fixing two double-escaping problems in Linker::link (Xml::element escapes the element text): * In Linker::userLink - already live in Wikimedia sites. * When no text is given, i.e. in Linker::linkText. Also fixing documentation comment to prevent more mistakes. --- includes/Linker.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index 852ea801bb..278e97465d 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -146,7 +146,7 @@ class Linker { * @param $target Title Can currently only be a Title, but this may * change to support Images, literal URLs, etc. * @param $text string The HTML contents of the element, i.e., - * the link text. This is raw HTML and will not be escaped. If null, + * the link text. This will be escaped. If null, * defaults to the prefixed text of the Title; or if the Title is just a * fragment, the contents of the fragment. * @param $query array The query string to append to the URL @@ -287,9 +287,9 @@ class Linker { # If the target is just a fragment, with no title, we return the frag- # ment text. Otherwise, we return the title text itself. if( $target->getPrefixedText() === '' and $target->getFragment() !== '' ) { - return htmlspecialchars( $target->getFragment() ); + return $target->getFragment(); } - return htmlspecialchars( $target->getPrefixedText() ); + return $target->getPrefixedText(); } /** @@ -1039,13 +1039,12 @@ class Linker { * @private */ function userLink( $userId, $userText ) { - $encName = htmlspecialchars( $userText ); if( $userId == 0 ) { $page = SpecialPage::getTitleFor( 'Contributions', $userText ); } else { $page = Title::makeTitle( NS_USER, $userText ); } - return $this->link( $page, $encName ); + return $this->link( $page, $userText ); } /** -- 2.20.1