From: Alexandre Emsenhuber Date: Wed, 11 Apr 2012 12:37:27 +0000 (+0200) Subject: Check for namespace existence in Title::makeTitleSafe(). X-Git-Tag: 1.31.0-rc.0~23929^2 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=9eb25dc032c7408c96af78253ac512fd3ceb2231;p=lhc%2Fweb%2Fwiklou.git Check for namespace existence in Title::makeTitleSafe(). Namespace existence has to be checked before calling Title::makeName() because otherwise it will fallback to a page with the same name, but in the main namespace which is not what we want here. Change-Id: I8c087390044c54dd0502c1b8bb9321dfaec6b5f7 --- diff --git a/includes/Title.php b/includes/Title.php index 769adb91f6..1876d75caa 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -317,6 +317,10 @@ class Title { * @return Title the new object, or NULL on an error */ public static function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ) { + if ( !MWNamespace::exists( $ns ) ) { + return null; + } + $t = new Title(); $t->mDbkeyform = Title::makeName( $ns, $title, $fragment, $interwiki ); if ( $t->secureAndSplit() ) {