Fix inconsistent i18n escaping in category paging links.
authorBrian Wolff <bawolff+wn@gmail.com>
Wed, 11 Oct 2017 20:29:05 +0000 (20:29 +0000)
committerBrian Wolff <bawolff+wn@gmail.com>
Wed, 11 Oct 2017 20:29:05 +0000 (20:29 +0000)
prev-page and next-page were being escaped when they were a
link, but not when they were plain text. They should be escaped
in both cases.

This issue was discovered with an experimental phan plugin I'm
working on.

Change-Id: I6caac76299b21a54cd7cb732ad93187e3d37c99e

includes/CategoryViewer.php

index 9d692d7..f36c758 100644 (file)
@@ -629,7 +629,7 @@ class CategoryViewer extends ContextSource {
         * @return string HTML
         */
        private function pagingLinks( $first, $last, $type = '' ) {
-               $prevLink = $this->msg( 'prev-page' )->text();
+               $prevLink = $this->msg( 'prev-page' )->escaped();
 
                $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
                if ( $first != '' ) {
@@ -638,13 +638,13 @@ class CategoryViewer extends ContextSource {
                        unset( $prevQuery["{$type}from"] );
                        $prevLink = $linkRenderer->makeKnownLink(
                                $this->addFragmentToTitle( $this->title, $type ),
-                               $prevLink,
+                               new HtmlArmor( $prevLink ),
                                [],
                                $prevQuery
                        );
                }
 
-               $nextLink = $this->msg( 'next-page' )->text();
+               $nextLink = $this->msg( 'next-page' )->escaped();
 
                if ( $last != '' ) {
                        $lastQuery = $this->query;
@@ -652,7 +652,7 @@ class CategoryViewer extends ContextSource {
                        unset( $lastQuery["{$type}until"] );
                        $nextLink = $linkRenderer->makeKnownLink(
                                $this->addFragmentToTitle( $this->title, $type ),
-                               $nextLink,
+                               new HtmlArmor( $nextLink ),
                                [],
                                $lastQuery
                        );