Alexia has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59420


Change subject: SpecialPageFactory::getLocalNameFor() can raise a PHP warning 
when trying to foreach over a null variable.
......................................................................

SpecialPageFactory::getLocalNameFor() can raise a PHP warning when trying to 
foreach over a null variable.

Change-Id: I275b124d705bacb0b4ce05579c48bb7d75caa17c
---
M includes/SpecialPageFactory.php
1 file changed, 10 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/20/59420/1

diff --git a/includes/SpecialPageFactory.php b/includes/SpecialPageFactory.php
index a53b901..34eff2f 100644
--- a/includes/SpecialPageFactory.php
+++ b/includes/SpecialPageFactory.php
@@ -551,13 +551,16 @@
                } 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;
+                       //Do a check is $aliases is an array since 
$wgContLang->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 ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/59420
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I275b124d705bacb0b4ce05579c48bb7d75caa17c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Alexia <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to