From d390ac8b929712c4beb160a1a53ea981e68b0c62 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 28 Jun 2005 19:56:17 +0000 Subject: [PATCH] * (bug 2567) Fix HTML escaping on category titles in list --- RELEASE-NOTES | 1 + includes/Parser.php | 2 +- languages/Language.php | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c75d9ffbe9..9a954dd40b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -405,6 +405,7 @@ Various bugfixes, small features, and a few experimental things: * Fixed a bug where Special:Contributions wouldn't remember the 'invert' status between next/previous buttons. * Move MonoBook printable link from tab to sidebar +* (bug 2567) Fix HTML escaping on category titles in list === Caveats === diff --git a/includes/Parser.php b/includes/Parser.php index 2dbc4e955e..d7128c488a 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1379,7 +1379,7 @@ class Parser if ( $ns == NS_CATEGORY ) { wfProfileIn( "$fname-category" ); - $t = $wgContLang->convert($nt->getText()); + $t = $wgContLang->convertHtml( $nt->getText() ); $s = rtrim($s . "\n"); # bug 87 $wgLinkCache->suspend(); # Don't save in links/brokenlinks diff --git a/languages/Language.php b/languages/Language.php index 87b8e9cbf9..27d33446f8 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -2786,6 +2786,17 @@ class Language { function convert( $text, $isTitle = false) { return $this->mConverter->convert($text, $isTitle); } + + /** + * Perform output conversion on a string, and encode for safe HTML output. + * @param string $text + * @param bool $isTitle -- wtf? + * @return string + * @todo this should get integrated somewhere sane + */ + function convertHtml( $text, $isTitle = false ) { + return htmlspecialchars( $this->convert( $text, $isTitle ) ); + } function convertCategoryKey( $key ) { return $this->mConverter->convertCategoryKey( $key ); -- 2.20.1