Prevent the following strict-standards warnings - i.e. when running with error_loggin...
authorNick Jenkins <nickj@users.mediawiki.org>
Wed, 29 Nov 2006 05:45:03 +0000 (05:45 +0000)
committerNick Jenkins <nickj@users.mediawiki.org>
Wed, 29 Nov 2006 05:45:03 +0000 (05:45 +0000)
* Strict Standards: Undefined index: switch in includes/Parser.php on line 3849
* Strict Standards: Undefined index: ref in includes/Parser.php on line 3818
* Strict Standards: Non-static method OutputPage::setEncodings() should not be called statically in index.php on line 11
* Strict Standards: Only variables should be assigned by reference in includes/Skin.php on line 888
* Strict Standards: Non-static method Title::newFromURL() should not be called statically in includes/SpecialContributions.php on line 178
* Strict Standards: Only variables should be assigned by reference in includes/GlobalFunctions.php on line 2054
* Strict Standards: Undefined index:  contributions-summary in languages/Language.php on line 764
* Strict Standards: Undefined index:  trackbackhtml in skins/MonoBook.php on line 86
* Strict Standards: Undefined index:  blockip in skins/MonoBook.php on line 204
* Strict Standards: Undefined index:  tagline in skins/MonoBook.php on line 261
* Strict Standards: Undefined index: uselang in includes/SkinTemplate.php on line 1159
* Strict Standards: Non-static method CoreParserFunctions::plural() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  0 in includes/SkinTemplate.php on line 196
* Strict Standards: Undefined index:  USE INDEX in includes/Database.php on line 1015
* Strict Standards: Undefined index:  image_tests in includes/Parser.php on line 3488
* Strict Standards: Undefined offset:  0 in includes/Parser.php on line 3507
* Strict Standards: Non-static method ChangesList::newFromUser() should not be called statically in includes/SpecialWatchlist.php on line 361
* Strict Standards: Non-static method RecentChange::newFromCurRow() should not be called statically in includes/SpecialWatchlist.php on line 367
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/Exception.php on line 168
* Strict Standards: Non-static method LogPage::logName() should not be called statically in includes/SpecialContributions.php on line 325
* Strict Standards: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush. in maintenance/commandLine.inc on line 191
* Strict Standards: Undefined index:  meatball in languages/Language.php on line 234
* Strict Standards: rmdir(/tmp/mwParser-2108164586-images/thumb): Directory not empty in maintenance/parserTests.inc on line 605
* Cleaning out some new temp files left over by parserTests (there were one or two straggler dirs/files that would persist after the test run ended, due to new tests being added over time)
* Strict Standards: Non-static method CoreParserFunctions::special() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Declaration of ListUsersPage::preprocessResults() should be compatible with that of QueryPage::preprocessResults() in includes/SpecialListusers.php on line 38
* Strict Standards: Only variables should be passed by reference in includes/SpecialBlockip.php on line 175
* Strict Standards: Skin::include_once(skins/Standard.deps.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in includes/Skin.php on line 121
* Strict Standards: Declaration of ApiMain::getResult() should be compatible with that of ApiBase::getResult() in includes/api/ApiMain.php on line 35
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/WikiError.php on line 63
* Strict Standards: Non-static method WikiError::isError() should not be called statically in includes/SpecialImport.php on line 64
* Strict Standards: Non-static method ImportStreamSource::newFromInterwiki() should not be called statically in includes/SpecialImport.php on line 58<b
* Strict Standards: Only variables should be assigned by reference in includes/SpecialUndelete.php on line 501
* Strict Standards: Non-static method Image::newFromName() should not be called statically in thumb.php on line 56
* Strict Standards: Non-static method CoreParserFunctions::numberoffiles() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Non-static method CoreParserFunctions::statisticsFunction() should not be called statically in includes/CoreParserFunctions.php on line 139
* Strict Standards: Non-static method CoreParserFunctions::isRaw() should not be called statically in includes/CoreParserFunctions.php on line 128
* Strict Standards: Non-static method CoreParserFunctions::grammar() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  1 in includes/SpecialMIMEsearch.php on line 130
* Strict Standards: Undefined index:  recentchangeslinked in skins/MonoBook.php on line 184
* Strict Standards: Declaration of DumpNotalkFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 612
* Strict Standards: Declaration of DumpNamespaceFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 665
* Strict Standards: Non-static method ImportStreamSource::newFromUpload() should not be called statically in includes/SpecialImport.php on line 46
* Strict Standards: Undefined offset:  5 in includes/Sanitizer.php on line 396
* Strict Standards: Undefined index:  wikidbUserName in includes/SpecialUserlogin.php on line 562
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 95
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 116
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryWatchlist.php on line 128
* Strict Standards: Undefined property:  stdClass::$rc_id in includes/api/ApiQueryBase.php on line 131
* Strict Standards: Undefined property:  stdClass::$rc_last_oldid in includes/api/ApiQueryBase.php on line 164
* Strict Standards: Undefined property:  stdClass::$rc_moved_to_ns in includes/api/ApiQueryBase.php on line 285
* Strict Standards: Undefined property:  stdClass::$rc_patrolled in includes/api/ApiQueryBase.php on line 176
* Strict Standards: Undefined index:  comment in includes/api/ApiFeedWatchlist.php on line 85
* Strict Standards: Undefined offset:  0 in includes/Skin.php on line 302
* Strict Standards: Non-static method User::SetupSession() should not be called statically in includes/SpecialUserlogin.php on line 15

... There are certain to be other things too, so this is not intended to be comprehensive, rather the above just stops most of the notifications I observed.

31 files changed:
includes/ChangesList.php
includes/CoreParserFunctions.php
includes/Database.php
includes/Exception.php
includes/Export.php
includes/GlobalFunctions.php
includes/Image.php
includes/LogPage.php
includes/OutputPage.php
includes/Parser.php
includes/QueryPage.php
includes/RecentChange.php
includes/Sanitizer.php
includes/Skin.php
includes/SkinTemplate.php
includes/SpecialBlockip.php
includes/SpecialImport.php
includes/SpecialListusers.php
includes/SpecialMIMEsearch.php
includes/SpecialUndelete.php
includes/SpecialUserlogin.php
includes/Title.php
includes/WikiError.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiMain.php
includes/api/ApiQueryBase.php
includes/api/ApiQueryWatchlist.php
languages/Language.php
maintenance/commandLine.inc
maintenance/parserTests.inc
skins/MonoBook.php

index fe3ec1b..80b8cf7 100644 (file)
@@ -46,7 +46,7 @@ class ChangesList {
         * @param $user User to fetch the list class for
         * @return ChangesList derivative
         */
-       function newFromUser( &$user ) {
+       public static function newFromUser( &$user ) {
                $sk =& $user->getSkin();
                $list = NULL;
                if( wfRunHooks( 'FetchChangesList', array( &$user, &$skin, &$list ) ) ) {
index c0cdba9..74a187b 100644 (file)
@@ -88,19 +88,19 @@ class CoreParserFunctions {
                }
        }
 
-       function formatNum( $parser, $num = '' ) {
+       static function formatNum( $parser, $num = '' ) {
                return $parser->getFunctionLang()->formatNum( $num );
        }
        
-       function grammar( $parser, $case = '', $word = '' ) {
+       static function grammar( $parser, $case = '', $word = '' ) {
                return $parser->getFunctionLang()->convertGrammar( $word, $case );
        }
 
-       function plural( $parser, $text = '', $arg0 = null, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null ) {
+       static function plural( $parser, $text = '', $arg0 = null, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null ) {
                return $parser->getFunctionLang()->convertPlural( $text, $arg0, $arg1, $arg2, $arg3, $arg4 );
        }
 
-       function displaytitle( $parser, $param = '' ) {
+       static function displaytitle( $parser, $param = '' ) {
                $parserOptions = new ParserOptions;
                $local_parser = clone $parser;
                $t2 = $local_parser->parse ( $param, $parser->mTitle, $parserOptions, false );
@@ -112,7 +112,7 @@ class CoreParserFunctions {
                return '';
        }
 
-       function isRaw( $param ) {
+       static function isRaw( $param ) {
                static $mwRaw;
                if ( !$mwRaw ) {
                        $mwRaw =& MagicWord::get( 'rawsuffix' );
@@ -124,7 +124,7 @@ class CoreParserFunctions {
                }
        }
 
-       function statisticsFunction( $func, $raw = null ) {
+       static function statisticsFunction( $func, $raw = null ) {
                if ( self::isRaw( $raw ) ) {
                        return call_user_func( array( 'SiteStats', $func ) );
                } else {
@@ -133,13 +133,13 @@ class CoreParserFunctions {
                }
        }
 
-       function numberofpages( $parser, $raw = null ) { return self::statisticsFunction( 'pages', $raw ); }
-       function numberofusers( $parser, $raw = null ) { return self::statisticsFunction( 'users', $raw ); }
-       function numberofarticles( $parser, $raw = null ) { return self::statisticsFunction( 'articles', $raw ); }
-       function numberoffiles( $parser, $raw = null ) { return self::statisticsFunction( 'images', $raw ); }
-       function numberofadmins( $parser, $raw = null ) { return self::statisticsFunction( 'admins', $raw ); }
+       static function numberofpages( $parser, $raw = null ) { return self::statisticsFunction( 'pages', $raw ); }
+       static function numberofusers( $parser, $raw = null ) { return self::statisticsFunction( 'users', $raw ); }
+       static function numberofarticles( $parser, $raw = null ) { return self::statisticsFunction( 'articles', $raw ); }
+       static function numberoffiles( $parser, $raw = null ) { return self::statisticsFunction( 'images', $raw ); }
+       static function numberofadmins( $parser, $raw = null ) { return self::statisticsFunction( 'admins', $raw ); }
 
-       function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
+       static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
                $count = SiteStats::pagesInNs( intval( $namespace ) );
                if ( self::isRaw( $raw ) ) {
                        global $wgContLang;
@@ -149,13 +149,13 @@ class CoreParserFunctions {
                }
        }
 
-       function language( $parser, $arg = '' ) {
+       static function language( $parser, $arg = '' ) {
                global $wgContLang;
                $lang = $wgContLang->getLanguageName( strtolower( $arg ) );
                return $lang != '' ? $lang : $arg;
        }
        
-       function pad( $string = '', $length = 0, $char = 0, $direction = STR_PAD_RIGHT ) {
+       static function pad( $string = '', $length = 0, $char = 0, $direction = STR_PAD_RIGHT ) {
                $length = min( max( $length, 0 ), 500 );
                $char = substr( $char, 0, 1 );
                return ( $string && (int)$length > 0 && strlen( trim( (string)$char ) ) > 0 )
@@ -163,19 +163,19 @@ class CoreParserFunctions {
                                : $string;
        }
        
-       function padleft( $parser, $string = '', $length = 0, $char = 0 ) {
+       static function padleft( $parser, $string = '', $length = 0, $char = 0 ) {
                return self::pad( $string, $length, $char, STR_PAD_LEFT );
        }
        
-       function padright( $parser, $string = '', $length = 0, $char = 0 ) {
+       static function padright( $parser, $string = '', $length = 0, $char = 0 ) {
                return self::pad( $string, $length, $char );
        }
        
-       function anchorencode( $parser, $text ) {
+       static function anchorencode( $parser, $text ) {
                return str_replace( '%', '.', str_replace('+', '_', urlencode( $text ) ) );
        }
 
-       function special( $parser, $text ) {
+       static function special( $parser, $text ) {
                $title = SpecialPage::getTitleForAlias( $text );
                if ( $title ) {
                        return $title->getPrefixedText();
index 5f5601f..fb4449b 100644 (file)
@@ -1019,7 +1019,7 @@ class Database {
                        $options = array( $options );
                }
                if( is_array( $table ) ) {
-                       if ( @is_array( $options['USE INDEX'] ) )
+                       if ( isset( $options['USE INDEX'] ) && is_array( $options['USE INDEX'] ) )
                                $from = ' FROM ' . $this->tableNamesWithUseIndex( $table, $options['USE INDEX'] );
                        else
                                $from = ' FROM ' . implode( ',', array_map( array( &$this, 'tableName' ), $table ) );
index 56f18d5..ac9c8a2 100644 (file)
@@ -165,7 +165,7 @@ function wfInstallExceptionHandler() {
  * Report an exception to the user
  */
 function wfReportException( Exception $e ) {
-        if ( is_a( $e, 'MWException' ) ) {
+        if ( $e instanceof MWException ) {
                 try {
                         $e->report();
                 } catch ( Exception $e2 ) {
index aa70e27..c9878c9 100644 (file)
@@ -597,7 +597,7 @@ class DumpFilter {
         * Override for page-based filter types.
         * @return bool
         */
-       function pass( $page, $string ) {
+       function pass( $page ) {
                return true;
        }
 }
index 238c77e..4887653 100644 (file)
@@ -2051,7 +2051,7 @@ function wfWikiID() {
  */
 function &wfGetDB( $db = DB_LAST, $groups = array() ) {
        global $wgLoadBalancer;
-       $ret =& $wgLoadBalancer->getConnection( $db, true, $groups );
+       $ret = $wgLoadBalancer->getConnection( $db, true, $groups );
        return $ret;
 }
 ?>
index 5170536..5e85602 100644 (file)
@@ -58,7 +58,7 @@ class Image
         * @param string $name name of the image, used to create a title object using Title::makeTitleSafe
         * @public
         */
-       function newFromName( $name ) {
+       public static function newFromName( $name ) {
                $title = Title::makeTitleSafe( NS_IMAGE, $name );
                if ( is_object( $title ) ) {
                        return new Image( $title );
index d25b8aa..dd39512 100644 (file)
@@ -107,7 +107,7 @@ class LogPage {
        /**
         * @static
         */
-       function logName( $type ) {
+       public static function logName( $type ) {
                global $wgLogNames;
 
                if( isset( $wgLogNames[$type] ) ) {
index 1dbcb9f..264b567 100644 (file)
@@ -652,7 +652,7 @@ class OutputPage {
        /**
         * @todo document
         */
-       public function setEncodings() {
+       public static function setEncodings() {
                global $wgInputEncoding, $wgOutputEncoding;
                global $wgUser, $wgContLang;
 
index 695a630..94b8215 100644 (file)
@@ -3485,7 +3485,7 @@ class Parser
                        $refers[$headlineCount] = $canonized_headline;
 
                        # count how many in assoc. array so we can track dupes in anchors
-                       @$refers[$canonized_headline]++;
+                       isset( $refers[$canonized_headline] ) ? $refers[$canonized_headline]++ : $refers[$canonized_headline] = 1;
                        $refcount[$headlineCount]=$refers[$canonized_headline];
 
                        # Don't number the heading if it is the only one (looks silly)
@@ -3503,7 +3503,7 @@ class Parser
                                $toc .= $sk->tocLine($anchor, $tocline, $numbering, $toclevel);
                        }
                        # give headline the correct <h#> tag
-                       @$head[$headlineCount] .= "<a name=\"$anchor\"></a><h".$level.$matches[2][$headlineCount];
+                       $head[$headlineCount] = "<a name=\"$anchor\"></a><h".$level.$matches[2][$headlineCount];
 
                        if( $showEditLink && ( !$istemplate || $templatetitle !== "" ) ) {
                                if ( empty( $head[$headlineCount] ) ) {
@@ -3815,7 +3815,7 @@ class Parser
         */
        function setHook( $tag, $callback ) {
                $tag = strtolower( $tag );
-               $oldVal = @$this->mTagHooks[$tag];
+               $oldVal = isset( $this->mTagHooks[$tag] ) ? $this->mTagHooks[$tag] : null;
                $this->mTagHooks[$tag] = $callback;
 
                return $oldVal;
@@ -3846,7 +3846,7 @@ class Parser
         * @return The old callback function for this name, if any
         */
        function setFunctionHook( $id, $callback, $flags = 0 ) {
-               $oldVal = @$this->mFunctionHooks[$id];
+               $oldVal = isset( $this->mFunctionHooks[$id] ) ? $this->mFunctionHooks[$id] : null;
                $this->mFunctionHooks[$id] = $callback;
 
                # Add to function cache
index 3839aae..d0fa9f6 100644 (file)
@@ -376,9 +376,9 @@ class QueryPage {
 
        /**
         * Do any necessary preprocessing of the result object.
-        * You should pass this by reference: &$db , &$res
+        * You should pass this by reference: &$db , &$res  [although probably no longer necessary in PHP5]
         */
-       function preprocessResults( $db, $res ) {}
+       function preprocessResults( &$db, &$res ) {}
 
        /**
         * Similar to above, but packaging in a syndicated feed instead of a web page
index 6204def..d1cda39 100644 (file)
@@ -54,7 +54,7 @@ class RecentChange
                return $rc;
        }
 
-       /* static */ function newFromCurRow( $row, $rc_this_oldid = 0 )
+       public static function newFromCurRow( $row, $rc_this_oldid = 0 )
        {
                $rc = new RecentChange;
                $rc->loadFromCurRow( $row, $rc_this_oldid );
index cda1478..0c0f724 100644 (file)
@@ -390,12 +390,13 @@ class Sanitizer {
                if(!$wgUseTidy) {
                        $tagstack = $tablestack = array();
                        foreach ( $bits as $x ) {
-                               $prev = error_reporting( E_ALL & ~( E_NOTICE | E_WARNING ) );
                                $regs = array();
-                               preg_match( '!^(/?)(\\w+)([^>]*?)(/{0,1}>)([^<]*)$!', $x, $regs );
-                               list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
-                               error_reporting( $prev );
-
+                               if( preg_match( '!^(/?)(\\w+)([^>]*?)(/{0,1}>)([^<]*)$!', $x, $regs ) ) {
+                                       list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
+                               } else {
+                                       $slash = $t = $params = $brace = $rest = null;
+                               }
+                               
                                $badtag = 0 ;
                                if ( isset( $htmlelements[$t = strtolower( $t )] ) ) {
                                        # Check our stack
index 43c7695..9900ff4 100644 (file)
@@ -116,10 +116,9 @@ class Skin extends Linker {
                $skinName = $skinNames[$key];
 
                # Grab the skin class and initialise it.
-               wfSuppressWarnings();
                // Preload base classes to work around APC/PHP5 bug
-               include_once( "{$wgStyleDirectory}/{$skinName}.deps.php" );
-               wfRestoreWarnings();
+               $deps = "{$wgStyleDirectory}/{$skinName}.deps.php";
+               if( file_exists( $deps ) ) include_once( $deps );
                require_once( "{$wgStyleDirectory}/{$skinName}.php" );
 
                # Check if we got if not failback to default skin
@@ -300,9 +299,9 @@ class Skin extends Linker {
                global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
                global $wgTitle, $wgCanonicalNamespaceNames, $wgOut;
 
-               $nsname = @$wgCanonicalNamespaceNames[ $wgTitle->getNamespace() ];
-               if ( $nsname === NULL ) $nsname = $wgTitle->getNsText();
-
+               $ns = $wgTitle->getNamespace();
+               $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
+               
                $vars = array( 
                        'jsmimetype' => $wgJsMimeType,
                        'skinname' => $this->getSkinName(),
@@ -884,7 +883,7 @@ END;
        }
 
        function getSearchLink() {
-               $searchPage =& SpecialPage::getTitleFor( 'Search' );
+               $searchPage = SpecialPage::getTitleFor( 'Search' );
                return $searchPage->getLocalURL();
        }
 
index f804114..c47e619 100644 (file)
@@ -193,8 +193,9 @@ class SkinTemplate extends Skin {
                $tpl->set( 'displaytitle', $wgOut->mPageLinkTitle );
                $tpl->set( 'pageclass', Sanitizer::escapeClass( 'page-'.$wgTitle->getPrefixedText() ) );
 
-               $nsname = @$wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ];
-               if ( $nsname === NULL ) $nsname = $this->mTitle->getNsText();
+               $nsname = isset( $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] ) ? 
+                         $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] :
+                         $this->mTitle->getNsText();
 
                $tpl->set( 'nscanonical', $nsname );
                $tpl->set( 'nsnumber', $this->mTitle->getNamespace() );
@@ -236,8 +237,11 @@ class SkinTemplate extends Skin {
                } else {
                        $tpl->set( 'feeds', false );
                }
-               if ($wgUseTrackbacks && $out->isArticleRelated())
-                       $tpl->set( 'trackbackhtml', $wgTitle->trackbackRDF());
+               if ($wgUseTrackbacks && $out->isArticleRelated()) {
+                       $tpl->set( 'trackbackhtml', $wgTitle->trackbackRDF() );
+               } else {
+                       $tpl->set( 'trackbackhtml', null );
+               }
 
                $tpl->setRef( 'mimetype', $wgMimeType );
                $tpl->setRef( 'jsmimetype', $wgJsMimeType );
@@ -513,14 +517,17 @@ class SkinTemplate extends Skin {
                        $href = self::makeSpecialUrl( "Contributions/$this->username" );
                        $personal_urls['mycontris'] = array(
                                'text' => wfMsg( 'mycontris' ),
-                               'href' => $href
-                               # FIXME #  'active' => ( $href == $pageurl . '/' . $this->username )
+                               'href' => $href,
+                               // FIXME #  'active' was disabed in r11346 with message: "disable bold link to my contributions; link was bold on all
+                               // Special:Contributions, not just current user's (fix me please!)". Until resolved, explicitly setting active to false.
+                               'active' => false # ( ( $href == $pageurl . '/' . $this->username ) 
                        );
                        $personal_urls['logout'] = array(
                                'text' => wfMsg( 'userlogout' ),
                                'href' => self::makeSpecialUrl( 'Userlogout',
                                        $wgTitle->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}"
-                               )
+                               ),
+                               'active' => false
                        );
                } else {
                        if( $wgShowIPinHeader && isset(  $_COOKIE[ini_get("session.name")] ) ) {
@@ -821,7 +828,9 @@ class SkinTemplate extends Skin {
                }
                $nav_urls['specialpages'] = array( 'href' => self::makeSpecialUrl( 'Specialpages' ) );
 
-
+               // default permalink to being off, will override it as required below.
+               $nav_urls['permalink'] = false;
+               
                // A print stylesheet is attached to all pages, but nobody ever
                // figures that out. :)  Add a link...
                if( $this->iscontent && ($action == '' || $action == 'view' || $action == 'purge' ) ) {
@@ -859,6 +868,8 @@ class SkinTemplate extends Skin {
                                $nav_urls['recentchangeslinked'] = array(
                                        'href' => $rclTitle->getLocalUrl()
                                );
+                       } else {
+                               $nav_urls['recentchangeslinked'] = false;
                        }
                        if ($wgUseTrackbacks)
                                $nav_urls['trackbacklink'] = array(
@@ -878,12 +889,16 @@ class SkinTemplate extends Skin {
                        $nav_urls['contributions'] = array(
                                'href' => self::makeSpecialUrl( 'Contributions/' . $this->mTitle->getText() )
                        );
-                       if ( $wgUser->isAllowed( 'block' ) )
+                       if ( $wgUser->isAllowed( 'block' ) ) {
                                $nav_urls['blockip'] = array(
                                        'href' => self::makeSpecialUrl( 'Blockip/' . $this->mTitle->getText() )
-                               );
+                               ); 
+                       } else {
+                               $nav_urls['blockip'] = false;
+                       }
                } else {
                        $nav_urls['contributions'] = false;
+                       $nav_urls['blockip'] = false;
                }
                $nav_urls['emailuser'] = false;
                if( $this->showEmailUser( $id ) ) {
@@ -1141,7 +1156,7 @@ class QuickTemplate {
         * @private
         */
        function haveData( $str ) {
-               return $this->data[$str];
+               return isset( $this->data[$str] );
        }
 
        /**
index 98d75ff..eb48d2c 100644 (file)
@@ -172,7 +172,8 @@ class IPBlockForm {
 
                $user = User::newFromName( $this->BlockAddress );
                if( is_object( $user ) ) {
-                       $this->showLogFragment( $wgOut, $user->getUserPage() );
+                       $page = $user->getUserPage();
+                       $this->showLogFragment( $wgOut, $page );
                } elseif( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $this->BlockAddress ) ) {
                        $this->showLogFragment( $wgOut, Title::makeTitle( NS_USER, $this->BlockAddress ) );
                }
index f147808..1c8ee2e 100644 (file)
@@ -817,7 +817,7 @@ class ImportStreamSource {
                return new ImportStreamSource( $file );
        }
 
-       function newFromUpload( $fieldname = "xmlimport" ) {
+       static function newFromUpload( $fieldname = "xmlimport" ) {
                $upload =& $_FILES[$fieldname];
 
                if( !isset( $upload ) || !$upload['name'] ) {
@@ -843,7 +843,7 @@ class ImportStreamSource {
                return $ret;
        }
 
-       function newFromInterwiki( $interwiki, $page, $history=false ) {
+       public static function newFromInterwiki( $interwiki, $page, $history=false ) {
                $link = Title::newFromText( "$interwiki:Special:Export/$page" );
                if( is_null( $link ) || $link->getInterwiki() == '' ) {
                        return new WikiErrorMsg( 'importbadinterwiki' );
index 4668d0c..b079434 100644 (file)
@@ -210,7 +210,7 @@ class ListUsersPage extends QueryPage {
  * $par string (optional) A group to list users from
  */
 function wfSpecialListusers( $par = null ) {
-       global $wgRequest, $wgContLang;
+       global $wgRequest;
 
        list( $limit, $offset ) = wfCheckLimits();
 
index cbbe6f9..8678118 100644 (file)
@@ -126,9 +126,12 @@ function wfSpecialMIMEsearch( $par = null ) {
 }
 
 function wfSpecialMIMEsearchParse( $str ) {
-       wfSuppressWarnings();
+       // searched for an invalid MIME type.
+       if( strpos( $str, '/' ) === false) {
+               return array ('', '');
+       }
+       
        list( $major, $minor ) = explode( '/', $str, 2 );
-       wfRestoreWarnings();
 
        return array(
                ltrim( $major, ' ' ),
index 9793b30..c78cae2 100644 (file)
@@ -498,7 +498,7 @@ class UndeleteForm {
                $wgOut->addWikiText( wfMsg( "undeletepagetext" ) );
 
                $sk = $wgUser->getSkin();
-               $undelete =& SpecialPage::getTitleFor( 'Undelete' );
+               $undelete = SpecialPage::getTitleFor( 'Undelete' );
                $wgOut->addHTML( "<ul>\n" );
                while( $row = $result->fetchObject() ) {
                        $title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title );
index 23d5c28..7205043 100644 (file)
@@ -12,7 +12,7 @@ function wfSpecialUserlogin() {
        global $wgCommandLineMode;
        global $wgRequest;
        if( !$wgCommandLineMode && !isset( $_COOKIE[session_name()] )  ) {
-               User::SetupSession();
+               wfSetupSession();
        }
 
        $form = new LoginForm( $wgRequest );
@@ -559,7 +559,7 @@ class LoginForm {
                        if ( $wgUser->isLoggedIn() ) {
                                $this->mName = $wgUser->getName();
                        } else {
-                               $this->mName = @$_COOKIE[$wgCookiePrefix.'UserName'];
+                               $this->mName = isset( $_COOKIE[$wgCookiePrefix.'UserName'] ) ? $_COOKIE[$wgCookiePrefix.'UserName'] : null;
                        }
                }
 
index f2b8d10..76cf0eb 100644 (file)
@@ -162,7 +162,7 @@ class Title {
         * @static
         * @access public
         */
-       function newFromURL( $url ) {
+       public static function newFromURL( $url ) {
                global $wgLegalTitleChars;
                $t = new Title();
 
index 1b2c03b..6986b1c 100644 (file)
@@ -59,8 +59,8 @@ class WikiError {
         * @return bool
         * @static
         */
-       function isError( &$object ) {
-               return is_a( $object, 'WikiError' );
+       public static function isError( &$object ) {
+               return $object instanceof WikiError;
        }
 }
 
index b2a8bd8..335df32 100644 (file)
@@ -82,7 +82,7 @@ class ApiFeedWatchlist extends ApiBase {
                $titleStr = $info['title'];
                $title = Title :: newFromText($titleStr);
                $titleUrl = $title->getFullUrl();
-               $comment = $info['comment'];
+               $comment = isset( $info['comment'] ) ? $info['comment'] : null;
                $timestamp = $info['timestamp'];
                $user = $info['user'];
 
index 22f02ba..43d1da4 100644 (file)
@@ -100,7 +100,7 @@ class ApiMain extends ApiBase {
                return $this->mRequest;
        }
 
-       public function getResult() {
+       public function getResult() {
                return $this->mResult;
        }
 
index 4064075..cc9a4fe 100644 (file)
@@ -92,7 +92,7 @@ abstract class ApiQueryBase extends ApiBase {
                $isDirNewer = ($dir === 'newer');
                $after = ($isDirNewer ? '>=' : '<=');
                $before = ($isDirNewer ? '<=' : '>=');
-               $db = $this->getDB();
+               $db = $this->getDB();
 
                if (!is_null($start))
                        $this->addWhere($field . $after . $db->addQuotes($start));
@@ -113,7 +113,7 @@ abstract class ApiQueryBase extends ApiBase {
        protected function select($method) {
 
                // getDB has its own profileDBIn/Out calls
-               $db = $this->getDB();
+               $db = $this->getDB();
 
                $this->profileDBIn();
                $res = $db->select($this->tables, $this->fields, $this->where, $method, $this->options);
@@ -127,10 +127,8 @@ abstract class ApiQueryBase extends ApiBase {
                $vals = array ();
 
                // ID
-               @ $tmp = $row-> {
-                       $prefix . '_id' };
-               if (!is_null($tmp))
-                       $vals[$prefix . 'id'] = intval($tmp);
+               if ( isset( $row-> { $prefix . '_id' } ) )
+                       $vals[$prefix . 'id'] = intval( $row-> { $prefix . '_id' } );
 
                // Title
                $title = ApiQueryBase :: addRowInfo_title($row, $prefix . '_namespace', $prefix . '_title');
@@ -161,9 +159,8 @@ abstract class ApiQueryBase extends ApiBase {
                                if (!is_null($tmp))
                                        $vals['revid'] = intval($tmp);
 
-                               @ $tmp = $row->rc_last_oldid;
-                               if (!is_null($tmp))
-                                       $vals['old_revid'] = intval($tmp);
+                               if ( isset( $row->rc_last_oldid ) )
+                                       $vals['old_revid'] = intval( $row->rc_last_oldid );
 
                                $title = ApiQueryBase :: addRowInfo_title($row, 'rc_moved_to_ns', 'rc_moved_to_title');
                                if ($title) {
@@ -173,8 +170,7 @@ abstract class ApiQueryBase extends ApiBase {
                                        $vals['new_title'] = $title->getPrefixedText();
                                }
 
-                               @ $tmp = $row->rc_patrolled;
-                               if (!is_null($tmp))
+                               if ( isset( $row->rc_patrolled ) )
                                        $vals['patrolled'] = '';
 
                                break;
@@ -282,8 +278,8 @@ abstract class ApiQueryBase extends ApiBase {
        }
 
        private static function addRowInfo_title($row, $nsfld, $titlefld) {
-               @ $ns = $row-> $nsfld;
-               if (!is_null($ns)) {
+               if ( isset( $row-> $nsfld ) ) {
+                       $ns = $row-> $nsfld;
                        @ $title = $row-> $titlefld;
                        if (!empty ($title))
                                return Title :: makeTitle($ns, $title);
index dbe01c9..e2557e9 100644 (file)
@@ -125,7 +125,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                $count = 0;
                $res = $this->select(__METHOD__);
 
-               $db = $this->getDB();
+               $db = $this->getDB();
                while ($row = $db->fetchObject($res)) {
                        if (++ $count > $limit) {
                                // We've reached the one extra which shows that there are additional pages to be had. Stop here...
index 2f00a99..dacb2aa 100644 (file)
@@ -231,12 +231,8 @@ class Language {
         */
        function getNsIndex( $text ) {
                $this->load();
-               $index = @$this->mNamespaceIds[$this->lc($text)];
-               if ( is_null( $index ) ) {
-                       return false;
-               } else {
-                       return $index;
-               }
+               $lctext = $this->lc($text);
+               return isset( $this->mNamespaceIds[$lctext] ) ? $this->mNamespaceIds[$lctext] : false;
        }
 
        /**
@@ -761,7 +757,7 @@ class Language {
 
        function getMessage( $key ) {
                $this->load();
-               return @$this->messages[$key];
+               return isset( $this->messages[$key] ) ? $this->messages[$key] : null;
        }
 
        function getAllMessages() {
@@ -1664,7 +1660,7 @@ class Language {
         */
        static function getMessageFor( $key, $code ) {
                self::loadLocalisation( $code );
-               return @self::$mLocalisationCache[$code]['messages'][$key];
+               return isset( self::$mLocalisationCache[$code]['messages'][$key] ) ? self::$mLocalisationCache[$code]['messages'][$key] : null;
        }
 
        /**
index 13e2ef5..18a1d71 100644 (file)
@@ -188,7 +188,9 @@ if ( file_exists( '/home/wikipedia/common/langlist' ) ) {
 }
 
 # Turn off output buffering again, it might have been turned on in the settings files
-@ob_end_flush();
+if( ob_get_level() ) {
+       ob_end_flush();
+}
 # Same with these
 $wgCommandLineMode = true;
 
index f3b1754..0f5a4bd 100644 (file)
@@ -571,21 +571,56 @@ class ParserTest {
         * @private
         */
        function teardownUploadDir( $dir ) {
-               unlink( "$dir/3/3a/Foobar.jpg" );
-               rmdir( "$dir/3/3a" );
-               rmdir( "$dir/3" );
-               @rmdir( "$dir/thumb/6/65" );
-               @rmdir( "$dir/thumb/6" );
-
-               @unlink( "$dir/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" );
-               @rmdir( "$dir/thumb/3/3a/Foobar.jpg" );
-               @rmdir( "$dir/thumb/3/3a" );
-               @rmdir( "$dir/thumb/3/39" ); # wtf?
-               @rmdir( "$dir/thumb/3" );
-               @rmdir( "$dir/thumb" );
-               @rmdir( "$dir" );
+               // delete the files first, then the dirs.
+               self::deleteFiles( 
+                       array (
+                               "$dir/3/3a/Foobar.jpg",
+                               "$dir/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg",
+                               "$dir/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg",
+                               "$dir/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg",
+                               "$dir/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg",
+                       )
+               );
+                   
+               self::deleteDirs(
+                       array ( 
+                               "$dir/3/3a",
+                               "$dir/3",
+                               "$dir/thumb/6/65",
+                               "$dir/thumb/6",
+                               "$dir/thumb/3/3a/Foobar.jpg",
+                               "$dir/thumb/3/3a",
+                               "$dir/thumb/3",
+                               "$dir/thumb",
+                               "$dir",
+                       )
+               );
        }
 
+       /**
+        * @desc delete the specified files, if they exist.
+        * @param array $files full paths to files to delete.
+        */
+       private static function deleteFiles( $files ) {
+               foreach( $files as $file ) {
+                       if( file_exists( $file ) ) {
+                               unlink( $file );
+                       }
+               }
+       }
+       
+       /**
+        * @desc delete the specified directories, if they exist. Must be empty.
+        * @param array $dirs full paths to directories to delete.
+        */
+       private static function deleteDirs( $dirs ) {
+               foreach( $dirs as $dir ) {
+                       if( is_dir( $dir ) ) {
+                               rmdir( $dir );
+                       }
+               }
+       }
+       
        /**
         * "Running test $desc..."
         * @private
index 4322e0d..eb1b3ce 100644 (file)
@@ -258,7 +258,7 @@ class MonoBookTemplate extends QuickTemplate {
                        'privacy', 'about', 'disclaimer', 'tagline',
                );
                foreach( $footerlinks as $aLink ) {
-                       if( $this->data[$aLink] ) {
+                       if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
 ?>                             <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
 <?php          }
                }