Merge "Check validity of fetched titles and show a descriptive messages when an inval...
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 14 Jun 2012 23:42:56 +0000 (23:42 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 14 Jun 2012 23:42:56 +0000 (23:42 +0000)
includes/specials/SpecialPopularpages.php

index 803f03e..9f84804 100644 (file)
@@ -56,7 +56,13 @@ class PopularPagesPage extends QueryPage {
         */
        function formatResult( $skin, $result ) {
                global $wgContLang;
-               $title = Title::makeTitle( $result->namespace, $result->title );
+
+               $title = Title::makeTitleSafe( $result->namespace, $result->title );
+               if( !$title ) {
+                       return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
+                               Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) );
+               }
+
                $link = Linker::linkKnown(
                        $title,
                        htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )