ImageListPager: Fix improper use of Title::newFromText().
authorKunal Mehta <legoktm@member.fsf.org>
Tue, 5 Apr 2016 19:49:55 +0000 (12:49 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Tue, 5 Apr 2016 19:49:55 +0000 (12:49 -0700)
The $defaultNamespace parameter to Title::newFromText() only applies if
a namespace prefix isn't included in the text. So if a username was
"Help:FooBar", the NS_USER prefix would not be applied.

Instead use Title::makeTitleSafe( NS_USER, ... ); which was designed for
this specific purpose.

Change-Id: Iafce73d352887947e61ae7c906ddf965e04fbf6f

includes/specials/pagers/ImageListPager.php

index 48f60ca..258ac83 100644 (file)
@@ -54,7 +54,7 @@ class ImageListPager extends TablePager {
                $this->mShowAll = $showAll;
 
                if ( $userName !== null && $userName !== '' ) {
-                       $nt = Title::newFromText( $userName, NS_USER );
+                       $nt = Title::makeTitleSafe( NS_USER, $userName );
                        if ( is_null( $nt ) ) {
                                $this->outputUserDoesNotExist( $userName );
                        } else {