From c3704788f97ad34911dea35c92cfe7d05cce6e0a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sat, 6 Dec 2014 10:50:10 +0100 Subject: [PATCH] Skin: handle invalid titles gracefully Linker::link throws a notice if given null instead of title. Title is constructed based on messages, so it can easily be null. Change-Id: I5451135966cbb3bbd09d2568cec6b936f3b88aa3 --- includes/skins/Skin.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index ce0c640e10..1a4ec98b18 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -482,9 +482,10 @@ abstract class Skin extends ContextSource { $msg = $this->msg( 'pagecategories' )->numParams( count( $allCats['normal'] ) )->escaped(); $linkPage = wfMessage( 'pagecategorieslink' )->inContentLanguage()->text(); + $title = Title::newFromText( $linkPage ); + $link = $title ? Linker::link( $title, $msg ) : $msg; $s .= ''; + $link . $colon . '' . ''; } # Hidden categories @@ -951,6 +952,10 @@ abstract class Skin extends ContextSource { // but we make the link target be the one site-wide page. $title = Title::newFromText( $this->msg( $page )->inContentLanguage()->text() ); + if ( !$title ) { + return ''; + } + return Linker::linkKnown( $title, $this->msg( $desc )->escaped() -- 2.20.1