Merge "Convert Special:DeletedContributions to use OOUI."
[lhc/web/wiklou.git] / includes / title / MediaWikiTitleCodec.php
index 38e9ecd..a937e75 100644 (file)
@@ -105,10 +105,16 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser {
         */
        public function formatTitle( $namespace, $text, $fragment = '', $interwiki = '' ) {
                if ( $namespace !== false ) {
-                       $namespace = $this->getNamespaceName( $namespace, $text );
+                       // Try to get a namespace name, but fallback
+                       // to empty string if it doesn't exist
+                       try {
+                               $nsName = $this->getNamespaceName( $namespace, $text );
+                       } catch ( InvalidArgumentException $e ) {
+                               $nsName = '';
+                       }
 
-                       if ( $namespace !== '' ) {
-                               $text = $namespace . ':' . $text;
+                       if ( $namespace !== 0 ) {
+                               $text = $nsName . ':' . $text;
                        }
                }