From 43940407d3fcb4f2de65b012d71c10a7bfc9f41d Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 27 May 2012 19:28:22 +0200 Subject: [PATCH] Check validity of fetched titles and show a descriptive messages when an invalid title is encountered. Change-Id: I84804c9d89e778d263c781393afe9c8f70395c99 --- includes/specials/SpecialUnwatchedpages.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/specials/SpecialUnwatchedpages.php b/includes/specials/SpecialUnwatchedpages.php index c4f99f89cd..4bd0232d09 100644 --- a/includes/specials/SpecialUnwatchedpages.php +++ b/includes/specials/SpecialUnwatchedpages.php @@ -68,13 +68,15 @@ class UnwatchedpagesPage extends QueryPage { function formatResult( $skin, $result ) { global $wgContLang; - $nt = Title::makeTitle( $result->namespace, $result->title ); + $nt = Title::makeTitleSafe( $result->namespace, $result->title ); + if ( !$nt ) { + return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ), + Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) ); + } + $text = $wgContLang->convert( $nt->getPrefixedText() ); - $plink = Linker::linkKnown( - $nt, - htmlspecialchars( $text ) - ); + $plink = Linker::linkKnown( $nt, htmlspecialchars( $text ) ); $token = WatchAction::getWatchToken( $nt, $this->getUser() ); $wlink = Linker::linkKnown( $nt, -- 2.20.1