Nikerabbit has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177971

Change subject: Skin: handle invalid titles gracefully
......................................................................

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
---
M includes/skins/Skin.php
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/71/177971/1

diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index 5604bc2..f401c92 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -482,9 +482,10 @@
 
                        $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 .= '<div id="mw-normal-catlinks" 
class="mw-normal-catlinks">' .
-                               Linker::link( Title::newFromText( $linkPage ), 
$msg )
-                               . $colon . '<ul>' . $t . '</ul>' . '</div>';
+                               $link . $colon . '<ul>' . $t . '</ul>' . 
'</div>';
                }
 
                # Hidden categories
@@ -951,6 +952,10 @@
                        // 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()

-- 
To view, visit https://gerrit.wikimedia.org/r/177971
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5451135966cbb3bbd09d2568cec6b936f3b88aa3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to