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
This commit is contained in:
Bryan Davis 2014-12-15 18:46:38 -07:00
parent 1c4eea8f35
commit 1beaee90bf

View file

@ -38,7 +38,7 @@ class SpecialInterwiki extends SpecialPage {
$action = $par ? $par : $request->getVal( 'action', $par );
$return = $this->getPageTitle();
switch( $action ) {
switch ( $action ) {
case 'delete':
case 'edit':
case 'add':
@ -231,7 +231,7 @@ class SpecialInterwiki extends SpecialPage {
$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 @@ class SpecialInterwiki extends SpecialPage {
);
$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 @@ class SpecialInterwiki extends SpecialPage {
$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.