Merge "Check for namespace existence in Title::makeTitleSafe()."
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 11 Apr 2012 19:44:24 +0000 (19:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 11 Apr 2012 19:44:25 +0000 (19:44 +0000)
includes/Title.php

index 769adb9..1876d75 100644 (file)
@@ -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() ) {