From 560ebfb7216246b4464c39848feab0edd307ccd2 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 18 Feb 2012 01:07:42 +0000 Subject: [PATCH] Fix possibly undefined variables Move $db further up Return something on all paths --- includes/FeedUtils.php | 1 + includes/UserMailer.php | 5 +++-- includes/api/ApiQueryBlocks.php | 4 +++- includes/specials/SpecialActiveusers.php | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 0e1c8f1842..d280db5b39 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -114,6 +114,7 @@ class FeedUtils { # $wgLang->time( $timestamp ) ), # wfMsg( 'currentrev' ) ); + $diffText = ''; // Don't bother generating the diff if we won't be able to show it if ( $wgFeedDiffCutoff > 0 ) { $de = new DifferenceEngine( $title, $oldid, $newid ); diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 0a2c2425f0..0a02e5280a 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -115,10 +115,11 @@ class UserMailer { * @return String */ static function arrayToHeaderString( $headers, $endl = "\n" ) { + $strings = array(); foreach( $headers as $name => $value ) { - $string[] = "$name: $value"; + $strings[] = "$name: $value"; } - return implode( $endl, $string ); + return implode( $endl, $strings ); } /** diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index 3c0d518629..824589cd30 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -77,6 +77,9 @@ class ApiQueryBlocks extends ApiQueryBase { $this->addOption( 'LIMIT', $params['limit'] + 1 ); $this->addTimestampWhereRange( 'ipb_timestamp', $params['dir'], $params['start'], $params['end'] ); + + $db = $this->getDB(); + if ( isset( $params['ids'] ) ) { $this->addWhereFld( 'ipb_id', $params['ids'] ); } @@ -100,7 +103,6 @@ class ApiQueryBlocks extends ApiQueryBase { } $prefix = substr( $lower, 0, 4 ); - $db = $this->getDB(); $this->addWhere( array( 'ipb_range_start' . $db->buildLike( $prefix, $db->anyString() ), "ipb_range_start <= '$lower'", diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index 617a802690..8f4a9431ce 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -129,7 +129,7 @@ class ActiveUsersPager extends UsersPager { $list = array(); foreach( self::getGroups( $row->user_id ) as $group ) { if ( isset( $this->groups[$group] ) ) { - return; + return ''; } $list[] = self::buildGroupLink( $group, $userName ); } -- 2.20.1