jenkins-bot has submitted this change and it was merged.

Change subject: Guard dereference of iwPrefix['iw_trans'] and 
iwPrefix['iw_local']
......................................................................


Guard dereference of iwPrefix['iw_trans'] and iwPrefix['iw_local']

Ensure that array indices exist before access to avoid PHP interpreter
undefined index warnings.

Patch also includes trivial whitespace fixes to correct codesniff failures.

Change-Id: I87021a358a85eb3adf7a222fbaee70623dfd8770
---
M Interwiki_body.php
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Anomie: Looks good to me, but someone else must approve
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Interwiki_body.php b/Interwiki_body.php
index 5a41fe6..0070cfb 100644
--- a/Interwiki_body.php
+++ b/Interwiki_body.php
@@ -38,7 +38,7 @@
                $action = $par ? $par : $request->getVal( 'action', $par );
                $return = $this->getPageTitle();
 
-               switch( $action ) {
+               switch ( $action ) {
                case 'delete':
                case 'edit':
                case 'add':
@@ -231,7 +231,7 @@
                $reason = $request->getText( 'wpInterwikiReason' );
                $selfTitle = $this->getPageTitle();
                $dbw = wfGetDB( DB_MASTER );
-               switch( $do ) {
+               switch ( $do ) {
                case 'delete':
                        $dbw->delete( 'interwiki', array( 'iw_prefix' => 
$prefix ), __METHOD__ );
 
@@ -442,7 +442,7 @@
                        );
                        $attribs = array( 'class' => 'mw-interwikitable-local' 
);
                        // Green background for cells with "yes".
-                       if( $iwPrefix['iw_local'] ) {
+                       if ( isset( $iwPrefix['iw_local'] ) && 
$iwPrefix['iw_local'] ) {
                                $attribs['class'] .= ' 
mw-interwikitable-local-yes';
                        }
                        // The messages interwiki_0 and interwiki_1 are used 
here.
@@ -452,7 +452,7 @@
                        $out .= Html::element( 'td', $attribs, $contents );
                        $attribs = array( 'class' => 'mw-interwikitable-trans' 
);
                        // Green background for cells with "yes".
-                       if( $iwPrefix['iw_trans'] ) {
+                       if ( isset( $iwPrefix['iw_trans'] ) && 
$iwPrefix['iw_trans'] ) {
                                $attribs['class'] .= ' 
mw-interwikitable-trans-yes';
                        }
                        // The messages interwiki_0 and interwiki_1 are used 
here.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I87021a358a85eb3adf7a222fbaee70623dfd8770
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Interwiki
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to