Fix possibly undefined variables
authorSam Reed <reedy@users.mediawiki.org>
Sat, 18 Feb 2012 01:07:42 +0000 (01:07 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 18 Feb 2012 01:07:42 +0000 (01:07 +0000)
Move $db further up

Return something on all paths

includes/FeedUtils.php
includes/UserMailer.php
includes/api/ApiQueryBlocks.php
includes/specials/SpecialActiveusers.php

index 0e1c8f1..d280db5 100644 (file)
@@ -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 );
index 0a2c242..0a02e52 100644 (file)
@@ -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 );
        }
 
        /**
index 3c0d518..824589c 100644 (file)
@@ -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'",
index 617a802..8f4a943 100644 (file)
@@ -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 );
                }