Make the deprecation notice actually useful by listing the class
[lhc/web/wiklou.git] / includes / specialpage / SpecialPageFactory.php
index dd22769..f5e4f0e 100644 (file)
@@ -243,11 +243,14 @@ class SpecialPageFactory {
                        $missingPages = clone self::getList();
 
                        self::$aliases = array();
-                       foreach ( $aliases as $realName => $aliasList ) {
-                               foreach ( $aliasList as $alias ) {
-                                       self::$aliases[$wgContLang->caseFold( $alias )] = $realName;
+                       // Check for $aliases being an array since Language::getSpecialPageAliases can return null
+                       if ( is_array( $aliases ) ) {
+                               foreach ( $aliases as $realName => $aliasList ) {
+                                       foreach ( $aliasList as $alias ) {
+                                               self::$aliases[$wgContLang->caseFold( $alias )] = $realName;
+                                       }
+                                       unset( $missingPages->$realName );
                                }
-                               unset( $missingPages->$realName );
                        }
                        foreach ( $missingPages as $name => $stuff ) {
                                self::$aliases[$wgContLang->caseFold( $name )] = $name;
@@ -344,10 +347,10 @@ class SpecialPageFactory {
 
                                return new $className;
                        } elseif ( is_array( $rec ) ) {
-                               // @deprecated, officially since 1.18, unofficially since forever
-                               wfDebug( "Array syntax for \$wgSpecialPages is deprecated, " .
-                                       "define a subclass of SpecialPage instead." );
                                $className = array_shift( $rec );
+                               // @deprecated, officially since 1.18, unofficially since forever
+                               wfDeprecated( "Array syntax for \$wgSpecialPages is deprecated ($className), " .
+                                       "define a subclass of SpecialPage instead.", '1.18' );
                                self::getList()->$realName = MWFunction::newObj( $className, $rec );
                        }
 
@@ -571,13 +574,16 @@ class SpecialPageFactory {
                } else {
                        // Try harder in case someone misspelled the correct casing
                        $found = false;
-                       foreach ( $aliases as $n => $values ) {
-                               if ( strcasecmp( $name, $n ) === 0 ) {
-                                       wfWarn( "Found alias defined for $n when searching for " .
-                                               "special page aliases for $name. Case mismatch?" );
-                                       $name = $values[0];
-                                       $found = true;
-                                       break;
+                       // Check for $aliases being an array since Language::getSpecialPageAliases can return null
+                       if ( is_array( $aliases ) ) {
+                               foreach ( $aliases as $n => $values ) {
+                                       if ( strcasecmp( $name, $n ) === 0 ) {
+                                               wfWarn( "Found alias defined for $n when searching for " .
+                                                       "special page aliases for $name. Case mismatch?" );
+                                               $name = $values[0];
+                                               $found = true;
+                                               break;
+                                       }
                                }
                        }
                        if ( !$found ) {