Code housekeeping stuff (and barring any stuff-ups on my behalf, there should be...
authorNick Jenkins <nickj@users.mediawiki.org>
Thu, 23 Nov 2006 08:25:56 +0000 (08:25 +0000)
committerNick Jenkins <nickj@users.mediawiki.org>
Thu, 23 Nov 2006 08:25:56 +0000 (08:25 +0000)
* removing some unused global declarations.
* removing or commenting out or adding comments for unused local vars.
* Adding one or two local var declarations.
* Declaring $matches array passed to preg_match() / preg_match_all() as array() before using [not required, just have a slight preference for the explicitness].
* remove one or two pass-by-reference function declarations where the value is not modified.
* Adding some braces to if-else blocks.
* In Parser.php, stripstrate is now an object rather than an array as per r17820, so we no longer need ask for a reference to it (as in "$x =& $this->mStripState;"), and in fact it's probably just simpler to get rid of $x altogether.
* Moving some preg regexes from "" quoting to '' quoting to stop static analyzer whinging about bad escape sequences.

... up to "LinksUpdate.php" in the includes/ directory.

57 files changed:
includes/Article.php
includes/DatabaseFunctions.php
includes/DatabaseOracle.php
includes/EditPage.php
includes/Exif.php
includes/GlobalFunctions.php
includes/HTMLForm.php
includes/ImagePage.php
includes/Licenses.php
includes/LinkBatch.php
includes/Linker.php
includes/MessageCache.php
includes/MimeMagic.php
includes/OutputPage.php
includes/Parser.php
includes/Profiler.php
includes/ProtectionForm.php
includes/RecentChange.php
includes/Sanitizer.php
includes/SearchEngine.php
includes/SearchPostgres.php
includes/SpecialAllpages.php
includes/SpecialBlockip.php
includes/SpecialContributions.php
includes/SpecialImport.php
includes/SpecialMovepage.php
includes/SpecialNewimages.php
includes/SpecialRecentchanges.php
includes/SpecialRecentchangeslinked.php
includes/SpecialRevisiondelete.php
includes/SpecialSearch.php
includes/SpecialUpload.php
includes/SpecialUserlogin.php
includes/SpecialUserrights.php
includes/SpecialWatchlist.php
includes/SpecialWhatlinkshere.php
includes/User.php
includes/Xml.php
includes/ZhClient.php
includes/api/ApiBase.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiFormatYaml_spyc.php
includes/api/ApiMain.php
includes/api/ApiOpenSearch.php
includes/api/ApiPageSet.php
includes/api/ApiQueryAllpages.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryWatchlist.php
includes/cbt/CBTCompiler.php
includes/normal/RandomTest.php
includes/normal/Utf8Test.php
includes/normal/UtfNormal.php
includes/normal/UtfNormalGenerate.php
includes/normal/UtfNormalTest.php

index abae3dd..d85a24b 100644 (file)
@@ -79,7 +79,7 @@ class Article {
                                }
                        } else {
                                if( $rt->getNamespace() == NS_SPECIAL ) {
-                                       // Gotta hand redirects to special pages differently:
+                                       // Gotta handle redirects to special pages differently:
                                        // Fill the HTTP response "Location" header and ignore
                                        // the rest of the page we're on.
                                        //
@@ -139,7 +139,7 @@ class Article {
         * @return Return the text of this revision
        */
        function getContent() {
-               global $wgRequest, $wgUser, $wgOut;
+               global $wgUser, $wgOut;
 
                wfProfileIn( __METHOD__ );
 
@@ -236,9 +236,6 @@ class Article {
 
                # Pre-fill content with error message so that if something
                # fails we'll have something telling us what we intended.
-
-               $t = $this->mTitle->getPrefixedText();
-
                $this->mOldId = $oldid;
                $this->fetchContent( $oldid );
        }
@@ -575,13 +572,10 @@ class Article {
        function getContributors($limit = 0, $offset = 0) {
                # XXX: this is expensive; cache this info somewhere.
 
-               $title = $this->mTitle;
                $contribs = array();
                $dbr =& wfGetDB( DB_SLAVE );
                $revTable = $dbr->tableName( 'revision' );
                $userTable = $dbr->tableName( 'user' );
-               $encDBkey = $dbr->addQuotes( $title->getDBkey() );
-               $ns = $title->getNamespace();
                $user = $this->getUser();
                $pageId = $this->getId();
 
@@ -784,9 +778,6 @@ class Article {
                                if( !$wasRedirected && $this->isCurrent() ) {
                                        $wgOut->setSubtitle( wfMsgHtml( 'redirectpagesub' ) );
                                }
-                               $targetUrl = $rt->escapeLocalURL();
-                               # fixme unused $titleText :
-                               $titleText = htmlspecialchars( $rt->getPrefixedText() );
                                $link = $sk->makeLinkObj( $rt );
 
                                $wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT" />' .
@@ -1924,7 +1915,7 @@ class Article {
         */
        function doDeleteArticle( $reason ) {
                global $wgUseSquid, $wgDeferredUpdateList;
-               global $wgPostCommitUpdateList, $wgUseTrackbacks;
+               global $wgUseTrackbacks;
 
                wfDebug( __METHOD__."\n" );
 
@@ -2041,8 +2032,6 @@ class Article {
                $bot = $wgRequest->getBool( 'bot' );
 
                # Replace all this user's current edits with the next one down
-               $tt = $this->mTitle->getDBKey();
-               $n = $this->mTitle->getNamespace();
 
                # Get the last editor
                $current = Revision::newFromTitle( $this->mTitle );
@@ -2409,8 +2398,7 @@ class Article {
                        'comment'    => $comment,
                        'minor_edit' => $minor ? 1 : 0,
                        ) );
-               # fixme : $revisionId never used
-               $revisionId = $revision->insertOn( $dbw );
+               $revision->insertOn( $dbw );
                $this->updateRevisionOn( $dbw, $revision );
                $dbw->commit();
 
@@ -2524,8 +2512,6 @@ class Article {
        static function onArticleEdit( $title ) {
                global $wgDeferredUpdateList, $wgUseFileCache;
 
-               $urls = array();
-
                // Invalidate caches of articles which include this page
                $update = new HTMLCacheUpdate( $title, 'templatelinks' );
                $wgDeferredUpdateList[] = $update;
index c9dc9e7..ca83b9e 100644 (file)
@@ -14,7 +14,6 @@
  * @param $fname String: name of the php function calling
  */
 function wfQuery( $sql, $db, $fname = '' ) {
-       global $wgOut;
        if ( !is_numeric( $db ) ) {
                # Someone has tried to call this the old way
                throw new FatalError( wfMsgNoDB( 'wrong_wfQuery_params', $db, $sql ) );
index 8163567..1a6f62f 100644 (file)
@@ -55,9 +55,6 @@ class DatabaseOracle extends Database {
                $this->mPassword = $password;
                $this->mDBname = $dbName;
 
-               $success = false;
-
-               $hstring="";
                $this->mConn = oci_new_connect($user, $password, $dbName, "AL32UTF8");
                if ( $this->mConn === false ) {
                        wfDebug( "DB connection error\n" );
@@ -147,7 +144,6 @@ class DatabaseOracle extends Database {
 
                for ($i = 1; $i <= $this->mNcols[$res]; $i++) {
                        $name = $this->mFieldNames[$res][$i];
-                       $type = $this->mFieldTypes[$res][$i];
                        if (isset($this->mFetchCache[$res][$this->mFetchID[$res]][$name]))
                                $value = $this->mFetchCache[$res][$this->mFetchID[$res]][$name];
                        else    $value = NULL;
@@ -165,7 +161,7 @@ class DatabaseOracle extends Database {
                        return false;
                $i = 0;
                $ret = array();
-               foreach ($r as $key => $value) {
+               foreach ($r as $value) {
                        wfdebug("ret[$i]=[$value]\n");
                        $ret[$i++] = $value;
                }
@@ -201,14 +197,19 @@ class DatabaseOracle extends Database {
 
        function lastError() {
                if ($this->mErr === false) {
-                       if ($this->mLastResult !== false) $what = $this->mLastResult;
-                       else if ($this->mConn !== false) $what = $this->mConn;
-                       else $what = false;
+                       if ($this->mLastResult !== false) { 
+                               $what = $this->mLastResult;
+                       } else if ($this->mConn !== false) {
+                               $what = $this->mConn;
+                       } else {
+                               $what = false;
+                       }
                        $err = ($what !== false) ? oci_error($what) : oci_error();
-                       if ($err === false)
+                       if ($err === false) {
                                $this->mErr = 'no error';
-                       else
+                       } else {
                                $this->mErr = $err['message'];
+                       }
                }
                return str_replace("\n", '<br />', $this->mErr);
        }
index 33db6fd..28fab28 100644 (file)
@@ -571,6 +571,7 @@ class EditPage {
                $this->mMetaData = '' ;
 
                # Check for spam
+               $matches = array();
                if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1, $matches ) ) {
                        $this->spamPage ( $matches[0] );
                        wfProfileOut( "$fname-checks" );
@@ -858,6 +859,7 @@ class EditPage {
                                        $s = wfMsg('editingcomment', $this->mTitle->getPrefixedText() );
                                } else {
                                        $s = wfMsg('editingsection', $this->mTitle->getPrefixedText() );
+                                       $matches = array();
                                        if( !$this->summary && !$this->preview && !$this->diff ) {
                                                preg_match( "/^(=+)(.+)\\1/mi",
                                                        $this->textbox1,
@@ -1513,6 +1515,7 @@ END
                }
                $currentText = $currentRevision->getText();
 
+               $result = '';
                if( wfMerge( $baseText, $editText, $currentText, $result ) ){
                        $editText = $result;
                        wfProfileOut( $fname );
index 2ab0feb..e21b4d9 100644 (file)
@@ -439,7 +439,7 @@ class Exif {
                        return false;
                }
 
-               if ( preg_match( "/^\s*$/", $in ) ) {
+               if ( preg_match( '/^\s*$/', $in ) ) {
                        $this->debug( $in, __FUNCTION__, 'input consisted solely of whitespace' );
                        return false;
                }
@@ -468,7 +468,8 @@ class Exif {
        }
 
        function isRational( $in ) {
-               if ( !is_array( $in ) && @preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero
+               $m = array();
+               if ( !is_array( $in ) && @preg_match( '/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero
                        return $this->isLong( $m[1] ) && $this->isLong( $m[2] );
                } else {
                        $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' );
@@ -477,7 +478,7 @@ class Exif {
        }
 
        function isUndefined( $in ) {
-               if ( !is_array( $in ) && preg_match( "/^\d{4}$/", $in ) ) { // Allow ExifVersion and FlashpixVersion
+               if ( !is_array( $in ) && preg_match( '/^\d{4}$/', $in ) ) { // Allow ExifVersion and FlashpixVersion
                        $this->debug( $in, __FUNCTION__, true );
                        return true;
                } else {
@@ -497,7 +498,8 @@ class Exif {
        }
 
        function isSrational( $in ) {
-               if ( !is_array( $in ) && preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero
+               $m = array();
+               if ( !is_array( $in ) && preg_match( '/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero
                        return $this->isSlong( $m[0] ) && $this->isSlong( $m[1] );
                } else {
                        $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' );
@@ -729,7 +731,7 @@ class FormatExif {
                        case 'DateTime':
                        case 'DateTimeOriginal':
                        case 'DateTimeDigitized':
-                               if( preg_match( "/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/", $val ) ) {
+                               if( preg_match( '/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/', $val ) ) {
                                        $tags[$tag] = $wgLang->timeanddate( wfTimestamp(TS_MW, $val) );
                                }
                                break;
@@ -1054,6 +1056,7 @@ class FormatExif {
         * @return mixed A floating point number or whatever we were fed
         */
        function formatNum( $num ) {
+               $m = array();
                if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) )
                        return $m[2] != 0 ? $m[1] / $m[2] : $num;
                else
@@ -1069,6 +1072,7 @@ class FormatExif {
         * @return mixed A floating point number or whatever we were fed
         */
        function formatFraction( $num ) {
+               $m = array();
                if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) ) {
                        $numerator = intval( $m[1] );
                        $denominator = intval( $m[2] );
index 14e49ea..50935e1 100644 (file)
@@ -52,6 +52,7 @@ if( !function_exists('iconv') ) {
 # UTF-8 substr function based on a PHP manual comment
 if ( !function_exists( 'mb_substr' ) ) {
        function mb_substr( $str, $start ) {
+               $ar = array();
                preg_match_all( '/./us', $str, $ar );
 
                if( func_num_args() >= 3 ) {
@@ -71,7 +72,7 @@ if ( !function_exists( 'array_diff_key' ) ) {
         */
        function array_diff_key( $left, $right ) {
                $result = $left;
-               foreach ( $left as $key => $value ) {
+               foreach ( array_keys($left) as $key ) {
                        if ( isset( $right[$key] ) ) {
                                unset( $result[$key] );
                        }
@@ -382,8 +383,6 @@ function wfMsgNoDBForContent( $key ) {
  * @return String: the requested message.
  */
 function wfMsgReal( $key, $args, $useDB = true, $forContent=false, $transform = true ) {
-       $fname = 'wfMsgReal';
-
        $message = wfMsgGetKey( $key, $useDB, $forContent, $transform );
        $message = wfMsgReplaceArgs( $message, $args );
        return $message;
@@ -530,7 +529,7 @@ function wfMsgWikiHtml( $key ) {
  *  <i>parsemag<i>: ??
  */
 function wfMsgExt( $key, $options ) {
-       global $wgOut, $wgMsgParserOptions, $wgParser;
+       global $wgOut, $wgParser;
 
        $args = func_get_args();
        array_shift( $args );
@@ -807,6 +806,7 @@ function wfClientAcceptsGzip() {
        global $wgUseGzip;
        if( $wgUseGzip ) {
                # FIXME: we may want to blacklist some broken browsers
+               $m = array();
                if( preg_match(
                        '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
                        $_SERVER['HTTP_ACCEPT_ENCODING'],
@@ -972,6 +972,7 @@ function wfEscapeShellArg( ) {
                        }
                        // Double the backslashes before the end of the string, because
                        // we will soon add a quote
+                       $m = array();
                        if ( preg_match( '/^(.*?)(\\\\+)$/', $arg, $m ) ) {
                                $arg = $m[1] . str_replace( '\\', '\\\\', $m[2] );
                        }
@@ -1095,6 +1096,7 @@ function wfAcceptToPrefs( $accept, $def = '*/*' ) {
        foreach( $parts as $part ) {
                # FIXME: doesn't deal with params like 'text/html; level=1'
                @list( $value, $qpart ) = explode( ';', $part );
+               $match = array();
                if( !isset( $qpart ) ) {
                        $prefs[$value] = 1;
                } elseif( preg_match( '/q\s*=\s*(\d*\.\d+)/', $qpart, $match ) ) {
@@ -1289,19 +1291,19 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
        $da = array();
        if ($ts==0) {
                $uts=time();
-       } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D",$ts,$da)) {
+       } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D',$ts,$da)) {
                # TS_DB
                $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
                            (int)$da[2],(int)$da[3],(int)$da[1]);
-       } elseif (preg_match("/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/D",$ts,$da)) {
+       } elseif (preg_match('/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/D',$ts,$da)) {
                # TS_EXIF
                $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
                        (int)$da[2],(int)$da[3],(int)$da[1]);
-       } elseif (preg_match("/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/D",$ts,$da)) {
+       } elseif (preg_match('/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/D',$ts,$da)) {
                # TS_MW
                $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
                            (int)$da[2],(int)$da[3],(int)$da[1]);
-       } elseif (preg_match("/^(\d{1,13})$/D",$ts,$datearray)) {
+       } elseif (preg_match('/^(\d{1,13})$/D',$ts,$da)) {
                # TS_UNIX
                $uts = $ts;
        } elseif (preg_match('/^(\d{1,2})-(...)-(\d\d(\d\d)?) (\d\d)\.(\d\d)\.(\d\d)/', $ts, $da)) {
@@ -1312,11 +1314,11 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
                # TS_ISO_8601
                $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
                        (int)$da[2],(int)$da[3],(int)$da[1]);
-       } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)[\+\- ](\d\d)$/",$ts,$da)) {
+       } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)[\+\- ](\d\d)$/',$ts,$da)) {
                # TS_POSTGRES
                $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
                (int)$da[2],(int)$da[3],(int)$da[1]);
-       } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/",$ts,$da)) {
+       } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/',$ts,$da)) {
                # TS_POSTGRES
                $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
                (int)$da[2],(int)$da[3],(int)$da[1]);
@@ -1687,7 +1689,7 @@ function wfShellExec( $cmd, &$retval=null ) {
        
        $output = array();
        $retval = 1; // error by default?
-       $lastline = exec( $cmd, $output, $retval );
+       exec( $cmd, $output, $retval ); // returns the last line of output.
        return implode( "\n", $output );
        
 }
@@ -1753,6 +1755,7 @@ function wfRegexReplacement( $string ) {
  * @return string
  */
 function wfBaseName( $path ) {
+       $matches = array();
        if( preg_match( '#([^/\\\\]*)[/\\\\]*$#', $path, $matches ) ) {
                return $matches[1];
        } else {
index 3ee8585..189e5c7 100644 (file)
@@ -99,7 +99,7 @@ class HTMLForm {
                if ( $this->mRequest->wasPosted() ) {
                        $arr = $this->mRequest->getArray( $varname );
                        if ( is_array( $arr ) ) {
-                               foreach ( $_POST[$varname] as $index => $element ) {
+                               foreach ( $_POST[$varname] as $element ) {
                                        $s .= htmlspecialchars( $element )."\n";
                                }
                        }
index 102ae49..247c539 100644 (file)
@@ -142,6 +142,7 @@ class ImagePage extends Article {
                $fields = array();
                $lines = explode( "\n", wfMsgForContent( 'metadata-fields' ) );
                foreach( $lines as $line ) {
+                       $matches = array();
                        if( preg_match( '/^\\*\s*(.*?)\s*$/', $line, $matches ) ) {
                                $fields[] = $matches[1];
                        }
@@ -536,15 +537,10 @@ END
         * @param $reason User provided reason for deletion.
         */
        function doDelete( $reason ) {
-               global $wgOut, $wgRequest, $wgUseSquid;
-               global $wgPostCommitUpdateList;
-
-               $fname = 'ImagePage::doDelete';
+               global $wgOut, $wgRequest;
 
                $oldimage = $wgRequest->getVal( 'oldimage' );
 
-               $dbw =& wfGetDB( DB_MASTER );
-
                if ( !is_null( $oldimage ) ) {
                        if ( strlen( $oldimage ) < 16 ) {
                                $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
index aaa4405..dd1308b 100644 (file)
@@ -63,12 +63,14 @@ class Licenses {
                                        $obj = new License( $line );
                                        $this->stackItem( $this->licenses, $levels, $obj );
                                } else {
-                                       if ( $level < count( $levels ) )
+                                       if ( $level < count( $levels ) ) {
                                                $levels = array_slice( $levels, 0, $level );
-                                       if ( $level == count( $levels ) )
+                                       }
+                                       if ( $level == count( $levels ) ) {
                                                $levels[$level - 1] = $line;
-                                       else if ( $level > count( $levels ) )
+                                       } else if ( $level > count( $levels ) ) {
                                                $levels[] = $line;
+                                       }
                                }
                        }
                }
index 061f1b1..53f6c01 100644 (file)
@@ -97,7 +97,7 @@ class LinkBatch {
 
                // The remaining links in $data are bad links, register them as such
                foreach ( $remaining as $ns => $dbkeys ) {
-                       foreach ( $dbkeys as $dbkey => $nothing ) {
+                       foreach ( array_keys($dbkeys) as $dbkey ) {
                                $title = Title::makeTitle( $ns, $dbkey );
                                $cache->addBadLinkObj( $title );
                                $ids[$title->getPrefixedDBkey()] = 0;
@@ -112,7 +112,6 @@ class LinkBatch {
         */
        function doQuery() {
                $fname = 'LinkBatch::doQuery';
-               $namespaces = array();
 
                if ( $this->isEmpty() ) {
                        return false;
@@ -161,7 +160,7 @@ class LinkBatch {
                        $sql .= "({$prefix}_namespace=$ns AND {$prefix}_title IN (";
 
                        $firstTitle = true;
-                       foreach( $dbkeys as $dbkey => $nothing ) {
+                       foreach( array_keys($dbkeys) as $dbkey ) {
                                if ( $firstTitle ) {
                                        $firstTitle = false;
                                } else {
index db82a77..ba66873 100644 (file)
@@ -38,7 +38,6 @@ class Linker {
        function getInterwikiLinkAttributes( $link, $text, $class='' ) {
                global $wgContLang;
 
-               $same = ($link == $text);
                $link = urldecode( $link );
                $link = $wgContLang->checkTitleEncoding( $link );
                $link = preg_replace( '/[\\x00-\\x1f]/', ' ', $link );
@@ -200,8 +199,6 @@ class Linker {
                        return "<!-- ERROR -->{$prefix}{$text}{$trail}";
                }
 
-               $ns = $nt->getNamespace();
-               $dbkey = $nt->getDBkey();
                if ( $nt->isExternal() ) {
                        $u = $nt->getFullURL();
                        $link = $nt->getPrefixedURL();
@@ -210,6 +207,7 @@ class Linker {
 
                        $inside = '';
                        if ( '' != $trail ) {
+                               $m = array();
                                if ( preg_match( '/^([a-z]+)(.*)$$/sD', $trail, $m ) ) {
                                        $inside = $m[1];
                                        $trail = $m[2];
@@ -381,8 +379,6 @@ class Linker {
         *                      the end of the link.
         */
        function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
-               $link = $nt->getPrefixedURL();
-
                $u = $nt->escapeLocalURL( $query );
 
                if ( '' == $text ) {
@@ -717,7 +713,6 @@ class Linker {
                        ### HOTFIX. Instead of breaking, return empty string.
                        return $text;
                } else {
-                       $name = $title->getDBKey();
                        $img  = new Image( $title );
                        if( $img->exists() ) {
                                $url  = $img->getURL();
@@ -901,6 +896,7 @@ class Linker {
                # some nasty regex.
                # We look for all comments, match any text before and after the comment,
                # add a separator where needed and format the comment itself with CSS
+               $match = array();
                while (preg_match('/(.*)\/\*\s*(.*?)\s*\*\/(.*)/', $comment,$match)) {
                        $pre=$match[1];
                        $auto=$match[2];
@@ -943,6 +939,7 @@ class Linker {
                        } else {
                                $text = $match[1];
                        }
+                       $submatch = array();
                        if( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) {
                                # Media link; trail not supported.
                                $linkRegexp = '/\[\[(.*?)\]\]/';
@@ -1094,6 +1091,7 @@ class Linker {
                }
                $inside = '';
                if ( '' != $trail ) {
+                       $m = array();
                        if ( preg_match( $regex, $trail, $m ) ) {
                                $inside = $m[1];
                                $trail = $m[2];
index 058ada5..532ce59 100644 (file)
@@ -298,8 +298,6 @@ class MessageCache {
                if ( !$dbr ) {
                        throw new MWException( 'Invalid database object' );
                }
-               $conditions = array( 'page_is_redirect' => 0,
-                                       'page_namespace' => NS_MEDIAWIKI);
                $res = $dbr->select( array( 'page', 'revision', 'text' ),
                        array( 'page_title', 'old_text', 'old_flags' ),
                        'page_is_redirect=0 AND page_namespace='.NS_MEDIAWIKI.' AND page_latest=rev_id AND rev_text_id=old_id',
@@ -315,7 +313,7 @@ class MessageCache {
                # Go through the language array and the extension array and make a note of
                # any keys missing from the cache
                $allMessages = Language::getMessagesFor( 'en' );
-               foreach ( $allMessages as $key => $value ) {
+               foreach ( array_keys($allMessages) as $key ) {
                        $uckey = $wgLang->ucfirst( $key );
                        if ( !array_key_exists( $uckey, $this->mCache ) ) {
                                $this->mCache[$uckey] = false;
@@ -326,7 +324,7 @@ class MessageCache {
                MessageCache::loadAllMessages();
 
                # Add them to the cache
-               foreach ( $this->mExtensionMessages as $key => $value ) {
+               foreach ( array_keys($this->mExtensionMessages) as $key ) {
                        $uckey = $wgLang->ucfirst( $key );
                        if ( !array_key_exists( $uckey, $this->mCache ) &&
                         ( isset( $this->mExtensionMessages[$key][$wgLang->getCode()] ) || isset( $this->mExtensionMessages[$key]['en'] ) )  ) {
@@ -345,7 +343,7 @@ class MessageCache {
                if ( !$this->mKeys ) {
                        $this->mKeys = array();
                        $allMessages = Language::getMessagesFor( 'en' );
-                       foreach ( $allMessages as $key => $value ) {
+                       foreach ( array_keys($allMessages) as $key ) {
                                $title = $wgContLang->ucfirst( $key );
                                array_push( $this->mKeys, $title );
                        }
index dd197c3..ca05dbb 100644 (file)
@@ -403,8 +403,6 @@ class MimeMagic {
                                        elseif ($tag==="svg") $mime= "image/svg";
                                        elseif (strpos($doctype,"-//W3C//DTD XHTML")===0) $mime= "text/html";
                                        elseif ($tag==="html") $mime= "text/html";
-
-                                       $test_more= false;
                                }
                        }
 
index b1bc128..1b8707e 100644 (file)
@@ -243,7 +243,7 @@ class OutputPage {
                $lb->execute();
 
                $sk =& $wgUser->getSkin();
-               foreach ( $categories as $category => $arbitrary ) {
+               foreach ( array_keys($categories) as $category ) {
                        $title = Title::makeTitleSafe( NS_CATEGORY, $category );
                        $text = $wgContLang->convertHtml( $title->getText() );
                        $this->mCategoryLinks[] = $sk->makeLinkObj( $title, $text );
@@ -512,7 +512,7 @@ class OutputPage {
        public function output() {
                global $wgUser, $wgOutputEncoding, $wgRequest;
                global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType;
-               global $wgJsMimeType, $wgStylePath, $wgUseAjax, $wgAjaxSearch, $wgScriptPath, $wgServer;
+               global $wgJsMimeType, $wgStylePath, $wgUseAjax, $wgAjaxSearch, $wgServer;
                global $wgStyleVersion;
 
                if( $this->mDoNothing ){
@@ -1010,8 +1010,8 @@ class OutputPage {
                if ( !is_array( $links2d ) ) {
                        return;
                }
-               foreach ( $links2d as $ns => $dbkeys ) {
-                       foreach( $dbkeys as $dbkey => $id ) {
+               foreach ( $links2d as $dbkeys ) {
+                       foreach( array_keys($dbkeys) as $dbkey ) {
                                $this->addKeyword( $dbkey );
                                if ( ++$count > 10 ) {
                                        break 2;
index 73ac43c..b1abe91 100644 (file)
@@ -383,10 +383,9 @@ class Parser
         */
        function recursiveTagParse( $text ) {
                wfProfileIn( __METHOD__ );
-               $x =& $this->mStripState;
-               wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$x ) );
-               $text = $this->strip( $text, $x );
-               wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$x ) );
+               wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) );
+               $text = $this->strip( $text, $this->mStripState );
+               wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) );
                $text = $this->internalParse( $text );
                wfProfileOut( __METHOD__ );
                return $text;
@@ -931,8 +930,7 @@ class Parser
                wfProfileIn( $fname );
 
                # Hook to suspend the parser in this state
-               $x =& $this->mStripState; // FIXME: Please check that this initialization is correct.
-               if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$x ) ) ) {
+               if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$this->mStripState ) ) ) {
                        wfProfileOut( $fname );
                        return $text ;
                }
@@ -1820,7 +1818,7 @@ class Parser
         * @return string less-or-more HTML with NOPARSE bits
         */
        function armorLinks( $text ) {
-               return preg_replace( "/\b(" . wfUrlProtocols() . ')/',
+               return preg_replace( '/\b(' . wfUrlProtocols() . ')/',
                        "{$this->mUniqPrefix}NOPARSE$1", $text );
        }
 
index 78003e0..b15f1c3 100644 (file)
@@ -164,7 +164,7 @@ class Profiler {
        }
 
        function getCallTreeLine($entry) {
-               list ($fname, $level, $start, $x, $end) = $entry;
+               list ($fname, $level, $start, /* $x */, $end) = $entry;
                $delta = $end - $start;
                $space = str_repeat(' ', $level);
 
@@ -208,7 +208,6 @@ class Profiler {
                # First, subtract the overhead!
                foreach ($this->mStack as $entry) {
                        $fname = $entry[0];
-                       $thislevel = $entry[1];
                        $start = $entry[2];
                        $end = $entry[4];
                        $elapsed = $end - $start;
@@ -229,7 +228,6 @@ class Profiler {
                # Collate
                foreach ($this->mStack as $index => $entry) {
                        $fname = $entry[0];
-                       $thislevel = $entry[1];
                        $start = $entry[2];
                        $end = $entry[4];
                        $elapsed = $end - $start;
index f96262f..254dda8 100644 (file)
@@ -130,7 +130,7 @@ class ProtectionForm {
                $out .= "<table id='mwProtectSet'>";
                $out .= "<tbody>";
                $out .= "<tr>\n";
-               foreach( $this->mRestrictions as $action => $required ) {
+               foreach( array_keys($this->mRestrictions) as $action ) {
                        /* Not all languages have V_x <-> N_x relation */
                        $out .= "<th>" . wfMsgHtml( 'restriction-' . $action ) . "</th>\n";
                }
index ebd4b33..6204def 100644 (file)
@@ -95,7 +95,7 @@ class RecentChange
        # Writes the data in this object to the database
        function save()
        {
-               global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix, $wgUseRCPatrol;
+               global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix;
                $fname = 'RecentChange::save';
 
                $dbw =& wfGetDB( DB_MASTER );
index 49a5f10..cda1478 100644 (file)
@@ -391,8 +391,9 @@ class Sanitizer {
                        $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;
+                               list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
                                error_reporting( $prev );
 
                                $badtag = 0 ;
@@ -487,7 +488,7 @@ class Sanitizer {
                        foreach ( $bits as $x ) {
                                preg_match( '/^(\\/?)(\\w+)([^>]*?)(\\/{0,1}>)([^<]*)$/',
                                $x, $regs );
-                               @list( $qbar, $slash, $t, $params, $brace, $rest ) = $regs;
+                               @list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
                                if ( isset( $htmlelements[$t = strtolower( $t )] ) ) {
                                        if( is_callable( $processCallback ) ) {
                                                call_user_func_array( $processCallback, array( &$params, $args ) );
@@ -1223,8 +1224,9 @@ class Sanitizer {
                $url = preg_replace( '/[\][<>"\\x00-\\x20\\x7F]/e', "urlencode('\\0')", $url );
                
                # Validate hostname portion
+               $matches = array();
                if( preg_match( '!^([^:]+:)(//[^/]+)?(.*)$!iD', $url, $matches ) ) {
-                       list( $whole, $protocol, $host, $rest ) = $matches;
+                       list( /* $whole */, $protocol, $host, $rest ) = $matches;
                        
                        // Characters that will be ignored in IDNs.
                        // http://tools.ietf.org/html/3454#section-3.1
index 32725a5..cec40c9 100644 (file)
@@ -126,6 +126,7 @@ class SearchEngine {
                }
 
                # Quoted term? Try without the quotes...
+               $matches = array();
                if( preg_match( '/^"([^"]+)"$/', $searchterm, $matches ) ) {
                        return SearchEngine::getNearMatch( $matches[1] );
                }
index faf53f0..fb4dd5b 100644 (file)
@@ -60,6 +60,7 @@ class SearchPostgres extends SearchEngine {
                $this->searchTerms = array();
 
                # FIXME: This doesn't handle parenthetical expressions.
+               $m = array();
                if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                          $filteredText, $m, PREG_SET_ORDER ) ) {
                        foreach( $m as $terms ) {
@@ -77,7 +78,7 @@ class SearchPostgres extends SearchEngine {
                                $this->searchTerms[] = $regexp;
                        }
                        wfDebug( "Would search with '$searchon'\n" );
-                       wfDebug( "Match with /\b" . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
+                       wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
                } else {
                        wfDebug( "Can't understand search query '{$this->filteredText}'\n" );
                }
index e868ec7..1fc4815 100644 (file)
@@ -83,8 +83,7 @@ function namespaceForm ( $namespace = NS_MAIN, $from = '' ) {
  * @param integer $namespace (default NS_MAIN)
  */
 function showToplevel ( $namespace = NS_MAIN, $including = false ) {
-       global $wgOut, $wgUser;
-       $sk = $wgUser->getSkin();
+       global $wgOut;
        $fname = "indexShowToplevel";
 
        # TODO: Either make this *much* faster or cache the title index points
@@ -186,8 +185,6 @@ function showToplevel ( $namespace = NS_MAIN, $including = false ) {
  */
 function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) {
        global $wgUser;
-       $sk = $wgUser->getSkin();
-       $dbr =& wfGetDB( DB_SLAVE );
 
        $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
        $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) );
@@ -241,7 +238,6 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
                $n = 0;
                $out = '<table style="background: inherit;" border="0" width="100%">';
 
-               $namespaces = $wgContLang->getFormattedNamespaces();
                while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) {
                        $t = Title::makeTitle( $s->page_namespace, $s->page_title );
                        if( $t ) {
@@ -298,18 +294,20 @@ function getNamespaceKeyAndText ($ns, $text) {
                return array( $ns, '', '' ); # shortcut for common case
 
        $t = Title::makeTitleSafe($ns, $text);
-       if ( $t && $t->isLocal() )
+       if ( $t && $t->isLocal() ) {
                return array( $t->getNamespace(), $t->getDBkey(), $t->getText() );
-       else if ( $t )
+       } else if ( $t ) {
                return NULL;
+       }
 
        # try again, in case the problem was an empty pagename
        $text = preg_replace('/(#|$)/', 'X$1', $text);
        $t = Title::makeTitleSafe($ns, $text);
-       if ( $t && $t->isLocal() )
+       if ( $t && $t->isLocal() ) {
                return array( $t->getNamespace(), '', '' );
-       else
+       } else {
                return NULL;
+       }
 }
 }
 
index fd1a8aa..98d75ff 100644 (file)
@@ -80,7 +80,6 @@ class IPBlockForm {
                }
 
                $scBlockAddress = htmlspecialchars( $this->BlockAddress );
-               $scBlockExpiry = htmlspecialchars( $this->BlockExpiry );
                $scBlockReason = htmlspecialchars( $this->BlockReason );
                $scBlockOtherTime = htmlspecialchars( $this->BlockOther );
                $scBlockExpiryOptions = htmlspecialchars( wfMsgForContent( 'ipboptions' ) );
@@ -189,6 +188,7 @@ class IPBlockForm {
 
                # Check for invalid specifications
                if ( ! preg_match( "/^$rxIP$/", $this->BlockAddress ) ) {
+                       $matches = array();
                        if ( preg_match( "/^($rxIP)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) {
                                if ( $wgSysopRangeBans ) {
                                        if ( $matches[2] > 31 || $matches[2] < 16 ) {
index 239fb8b..5d058e9 100644 (file)
@@ -168,7 +168,6 @@ class ContribsFinder {
  */
 function wfSpecialContributions( $par = null ) {
        global $wgUser, $wgOut, $wgLang, $wgRequest;
-       $fname = 'wfSpecialContributions';
 
        $target = isset( $par ) ? $par : $wgRequest->getVal( 'target' );
        if ( !strlen( $target ) ) {
index 04deb1b..f147808 100644 (file)
@@ -208,7 +208,7 @@ class ImportReporter {
                        $dbw = wfGetDB( DB_MASTER );
                        $nullRevision = Revision::newNullRevision(
                                $dbw, $title->getArticleId(), $comment, true );
-                       $nullRevId = $nullRevision->insertOn( $dbw );
+                       $nullRevision->insertOn( $dbw );
                }
        }
        
@@ -304,7 +304,6 @@ class WikiRevision {
        }
 
        function importOldRevision() {
-               $fname = "WikiImporter::importOldRevision";
                $dbw =& wfGetDB( DB_MASTER );
 
                # Sneak a single revision into place
index 1b9e7b2..6701c08 100644 (file)
@@ -9,7 +9,7 @@
  * Constructor
  */
 function wfSpecialMovepage( $par = null ) {
-       global $wgUser, $wgOut, $wgRequest, $action, $wgOnlySysopMayMove;
+       global $wgUser, $wgOut, $wgRequest, $action;
 
        # Check rights
        if ( !$wgUser->isAllowed( 'move' ) ) {
@@ -189,7 +189,6 @@ class MovePageForm {
 
        function doSubmit() {
                global $wgOut, $wgUser, $wgRequest;
-               $fname = "MovePageForm::doSubmit";
 
                if ( $wgUser->pingLimiter( 'move' ) ) {
                        $wgOut->rateLimited();
index 66cf426..062e7e1 100644 (file)
@@ -9,7 +9,7 @@
  *
  */
 function wfSpecialNewimages( $par, $specialPage ) {
-       global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgGroupPermissions;
+       global $wgUser, $wgOut, $wgLang, $wgRequest, $wgGroupPermissions;
 
        $wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
        $dbr =& wfGetDB( DB_SLAVE );
@@ -67,9 +67,11 @@ function wfSpecialNewimages( $par, $specialPage ) {
        /** Hardcode this for now. */
        $limit = 48;
 
-       if ( $parval = intval( $par ) )
-               if ( $parval <= $limit && $parval > 0 )
+       if ( $parval = intval( $par ) ) {
+               if ( $parval <= $limit && $parval > 0 ) {
                        $limit = $parval;
+               }
+       }
 
        $where = array();
        $searchpar = '';
@@ -163,7 +165,6 @@ function wfSpecialNewimages( $par, $specialPage ) {
                  htmlspecialchars( $wpIlMatch ) . "\" /> " .
                  "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" );
        }
-       $here = $wgContLang->specialPage( 'Newimages' );
 
        /**
         * Paging controls...
index cfa115f..b7ed130 100644 (file)
@@ -14,7 +14,7 @@ require_once( 'ChangesList.php' );
  * Constructor
  */
 function wfSpecialRecentchanges( $par, $specialPage ) {
-       global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol, $wgDBtype;
+       global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol;
        global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
        global $wgAllowCategorizedRecentChanges ;
        $fname = 'wfSpecialRecentchanges';
@@ -90,7 +90,8 @@ function wfSpecialRecentchanges( $par, $specialPage ) {
                                if ( is_numeric( $bit ) ) {
                                        $limit = $bit;
                                }
-
+                               
+                               $m = array();
                                if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
                                        $limit = $m[1];
                                }
@@ -222,7 +223,6 @@ function wfSpecialRecentchanges( $par, $specialPage ) {
                }
 
                // And now for the content
-               $sk = $wgUser->getSkin();
                $wgOut->setSyndicated( true );
 
                $list = ChangesList::newFromUser( $wgUser );
@@ -397,7 +397,6 @@ function rcDoOutputFeed( $rows, &$feed ) {
                        $sorted[$n] = $obj;
                        $n++;
                }
-               $first = false;
        }
 
        foreach( $sorted as $obj ) {
index 59a3beb..8dcb1dd 100644 (file)
@@ -48,7 +48,7 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
                if ( ! $days ) { $days = 7; }
        }
        $days = (int)$days;
-       list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
+       list( $limit, /* offset */ ) = wfCheckLimits( 100, 'rclimit' );
 
        $dbr =& wfGetDB( DB_SLAVE );
        $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
index 1ab505d..fb5e9ec 100644 (file)
  */
 
 function wfSpecialRevisiondelete( $par = null ) {
-       global $wgOut, $wgRequest, $wgUser;
+       global $wgOut, $wgRequest;
        
        $target = $wgRequest->getVal( 'target' );
        $oldid = $wgRequest->getIntArray( 'oldid' );
        
-       $sk = $wgUser->getSkin();
        $page = Title::newFromUrl( $target );
        
        if( is_null( $page ) ) {
@@ -156,7 +155,7 @@ class RevisionDeleteForm {
        function extractBitfield( $request ) {
                $bitfield = 0;
                foreach( $this->checks as $item ) {
-                       list( $message, $name, $field ) = $item;
+                       list( /* message */ , $name, $field ) = $item;
                        if( $request->getCheck( $name ) ) {
                                $bitfield |= $field;
                        }
@@ -167,7 +166,7 @@ class RevisionDeleteForm {
        function save( $bitfield, $reason ) {
                $dbw = wfGetDB( DB_MASTER );
                $deleter = new RevisionDeleter( $dbw );
-               $ok = $deleter->setVisibility( $this->revisions, $bitfield, $reason );
+               $deleter->setVisibility( $this->revisions, $bitfield, $reason );
        }
 }
 
index 8c2f8aa..d28f059 100644 (file)
@@ -70,7 +70,7 @@ class SpecialSearch {
        }
 
        /**
-        * If an exact title match can be found, jump straight ahead to
+        * If an exact title match can be found, jump straight ahead to it.
         * @param string $term
         * @public
         */
@@ -82,7 +82,6 @@ class SpecialSearch {
                $this->setupPage( $term );
 
                # Try to go to page as entered.
-               #
                $t = Title::newFromText( $term );
 
                # If the string cannot be used to create a title
index 768c14f..937d9fc 100644 (file)
@@ -106,7 +106,7 @@ class UploadForm {
         * @access private
         */
        function initializeFromUrl( $request ) {
-               global $wgTmpDirectory, $wgMaxUploadSize;
+               global $wgTmpDirectory;
                $url = $request->getText( 'wpUploadFileURL' );
                $local_file = tempnam( $wgTmpDirectory, 'WEBUPLOAD' );
 
@@ -126,7 +126,7 @@ class UploadForm {
         * Returns true if there was an error, false otherwise
         */
        private function curlCopy( $url, $dest ) {
-               global $wgMaxUploadSize, $wgUser, $wgOut;
+               global $wgUser, $wgOut;
 
                if( !$wgUser->isAllowed( 'upload_by_url' ) ) {
                        $wgOut->permissionRequired( 'upload_by_url' );
@@ -704,8 +704,6 @@ class UploadForm {
                $wgOut->addHTML( '<div id="uploadtext">' );
                $wgOut->addWikiText( wfMsg( 'uploadtext' ) );
                $wgOut->addHTML( '</div>' );
-               $sk = $wgUser->getSkin();
-
 
                $sourcefilename = wfMsgHtml( 'sourcefilename' );
                $destfilename = wfMsgHtml( 'destfilename' );
@@ -732,7 +730,6 @@ class UploadForm {
 
                // Prepare form for upload or upload/copy
                if( $wgAllowCopyUploads && $wgUser->isAllowed( 'upload_by_url' ) ) {
-                       $source_comment = wfMsgHtml( 'upload_source_url' );
                        $filename_form = 
                                "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked />" . 
                                "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' onfocus='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" . 
@@ -1055,13 +1052,13 @@ class UploadForm {
                $chunk = Sanitizer::decodeCharReferences( $chunk );
 
                #look for script-types
-               if (preg_match("!type\s*=\s*['\"]?\s*(\w*/)?(ecma|java)!sim",$chunk)) return true;
+               if (preg_match('!type\s*=\s*[\'"]?\s*(\w*/)?(ecma|java)!sim',$chunk)) return true;
 
                #look for html-style script-urls
-               if (preg_match("!(href|src|data)\s*=\s*['\"]?\s*(ecma|java)script:!sim",$chunk)) return true;
+               if (preg_match('!(href|src|data)\s*=\s*[\'"]?\s*(ecma|java)script:!sim',$chunk)) return true;
 
                #look for css-style script-urls
-               if (preg_match("!url\s*\(\s*['\"]?\s*(ecma|java)script:!sim",$chunk)) return true;
+               if (preg_match('!url\s*\(\s*[\'"]?\s*(ecma|java)script:!sim',$chunk)) return true;
 
                wfDebug("SpecialUpload::detectScript: no scripts found\n");
                return false;
@@ -1113,21 +1110,25 @@ class UploadForm {
                #NOTE: there's a 50 line workaround to make stderr redirection work on windows, too.
                #      that does not seem to be worth the pain.
                #      Ask me (Duesentrieb) about it if it's ever needed.
+               $output = array();
                if (wfIsWindows()) exec("$scanner",$output,$code);
                else exec("$scanner 2>&1",$output,$code);
 
-               $exit_code= $code; #remeber for user feedback
+               $exit_code= $code; #remember for user feedback
 
                if ($virus_scanner_codes) { #map exit code to AV_xxx constants.
-                       if (isset($virus_scanner_codes[$code])) $code= $virus_scanner_codes[$code]; #explicite mapping
-                       else if (isset($virus_scanner_codes["*"])) $code= $virus_scanner_codes["*"]; #fallback mapping
+                       if (isset($virus_scanner_codes[$code])) {
+                               $code= $virus_scanner_codes[$code]; # explicit mapping
+                       } else if (isset($virus_scanner_codes["*"])) {
+                               $code= $virus_scanner_codes["*"];   # fallback mapping
+                       }
                }
 
                if ($code===AV_SCAN_FAILED) { #scan failed (code was mapped to false by $virus_scanner_codes)
                        wfDebug("$fname: failed to scan $file (code $exit_code).\n");
 
-                       if ($wgAntivirusRequired) return "scan failed (code $exit_code)";
-                       else return NULL;
+                       if ($wgAntivirusRequired) { return "scan failed (code $exit_code)"; }
+                       else { return NULL; }
                }
                else if ($code===AV_SCAN_ABORTED) { #scan failed because filetype is unknown (probably imune)
                        wfDebug("$fname: unsupported file type $file (code $exit_code).\n");
@@ -1141,7 +1142,7 @@ class UploadForm {
                        $output= join("\n",$output);
                        $output= trim($output);
 
-                       if (!$output) $output= true; #if ther's no output, return true
+                       if (!$output) $output= true; #if there's no output, return true
                        else if ($msg_pattern) {
                                $groups= array();
                                if (preg_match($msg_pattern,$output,$groups)) {
index 719ab37..23d5c28 100644 (file)
@@ -177,7 +177,6 @@ class LoginForm {
                } else {
                        # Confirm that the account was created
                        global $wgOut;
-                       $skin = $wgUser->getSkin();
                        $self = SpecialPage::getTitleFor( 'Userlogin' );
                        $wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) );
                        $wgOut->setArticleRelated( false );
index 4edbf12..0afcb48 100644 (file)
@@ -89,7 +89,6 @@ class UserrightsForm extends HTMLForm {
 
                $oldGroups = $u->getGroups();
                $newGroups = $oldGroups;
-               $logcomment = ' ';
                // remove then add groups
                if(isset($removegroup)) {
                        $newGroups = array_diff($newGroups, $removegroup);
index bc170b3..760bb8d 100644 (file)
@@ -150,21 +150,17 @@ function wfSpecialWatchlist( $par ) {
        wfAppendToArrayIfNotDefault( 'namespace', $nameSpace, $defaults, $nondefaults );
 
        if ( $days <= 0 ) {
-               $docutoff = '';
                $cutoff = false;
                $npages = wfMsg( 'watchlistall1' );
        } else {
-               $docutoff = "AND rev_timestamp > '" .
-                 ( $cutoff = $dbr->timestamp( time() - intval( $days * 86400 ) ) )
-                 . "'";
-                 /*
-                 $sql = "SELECT COUNT(*) AS n FROM $page, $revision  WHERE rev_timestamp>'$cutoff' AND page_id=rev_page";
-                 $res = $dbr->query( $sql, $fname );
-                 $s = $dbr->fetchObject( $res );
-                 $npages = $s->n;
-                 */
-                 $npages = 40000 * $days;
-
+               $cutoff = $dbr->timestamp( time() - intval( $days * 86400 ) );
+               /*
+               $sql = "SELECT COUNT(*) AS n FROM $page, $revision  WHERE rev_timestamp>'$cutoff' AND page_id=rev_page";
+               $res = $dbr->query( $sql, $fname );
+               $s = $dbr->fetchObject( $res );
+               $npages = $s->n;
+               */
+               $npages = 40000 * $days;
        }
 
        /* Edit watchlist form */
@@ -215,7 +211,6 @@ function wfSpecialWatchlist( $par ) {
                                } else {
                                        global $wgContLang;
                                        $toolLinks = array();
-                                       $titleText = $titleObj->getPrefixedText();
                                        $pageLink = $sk->makeLinkObj( $titleObj );
                                        $toolLinks[] = $sk->makeLinkObj( $titleObj->getTalkPage(), $wgLang->getNsText( NS_TALK ) );
                                        if( $titleObj->exists() )
@@ -327,7 +322,6 @@ function wfSpecialWatchlist( $par ) {
        # Spit out some control panel links
        $thisTitle = SpecialPage::getTitleFor( 'Watchlist' );
        $skin = $wgUser->getSkin();
-       $linkElements = array( 'hideOwn' => 'wlhideshowown', 'hideBots' => 'wlhideshowbots' );
        
        # Problems encountered using the fancier method
        $label = $hideBots ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' );
@@ -428,7 +422,6 @@ function wlDaysLink( $d, $page, $options = array() ) {
 function wlCutoffLinks( $days, $page = 'Watchlist', $options = array() ) {
        $hours = array( 1, 2, 6, 12 );
        $days = array( 1, 3, 7 );
-       $cl = '';
        $i = 0;
        foreach( $hours as $h ) {
                $hours[$i++] = wlHoursLink( $h, $page, $options );
index a95530f..438f52e 100644 (file)
@@ -57,8 +57,6 @@ class WhatLinksHerePage {
                $wgOut->setPagetitle( $this->target->getPrefixedText() );
                $wgOut->setSubtitle( wfMsg( 'linklistsub' ) );
 
-               $isredir = ' (' . wfMsg( 'isredirect' ) . ")\n";
-
                $wgOut->addHTML( wfMsg( 'whatlinkshere-barrow' ) . ' '  .$this->skin->makeLinkObj($this->target, '', 'redirect=no' )."<br />\n");
 
                $this->showIndirectLinks( 0, $this->target, $this->limit, $this->from, $this->dir );
index 7a3a885..8d402ef 100644 (file)
@@ -344,7 +344,7 @@ class User {
         * @return bool
         */
        static function isIP( $name ) {
-               return preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/",$name);
+               return preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/',$name);
                /*return preg_match("/^
                        (?:[01]?\d{1,2}|2(:?[0-4]\d|5[0-5]))\.
                        (?:[01]?\d{1,2}|2(:?[0-4]\d|5[0-5]))\.
@@ -873,6 +873,7 @@ class User {
                $found = false;
                $host = '';
 
+               $m = array();
                if ( preg_match( '/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/', $ip, $m ) ) {
                        # Make hostname
                        for ( $i=4; $i>=1; $i-- ) {
@@ -939,6 +940,7 @@ class User {
                        if( isset( $limits['ip'] ) ) {
                                $keys["mediawiki:limiter:$action:ip:$ip"] = $limits['ip'];
                        }
+                       $matches = array();
                        if( isset( $limits['subnet'] ) && preg_match( '/^(\d+\.\d+\.\d+)\.\d+$/', $ip, $matches ) ) {
                                $subnet = $matches[1];
                                $keys["mediawiki:limiter:$action:subnet:$subnet"] = $limits['subnet'];
@@ -1585,7 +1587,7 @@ class User {
         * @todo FIXME : need to check the old failback system [AV]
         */
        function &getSkin() {
-               global $IP, $wgRequest;
+               global $wgRequest;
                if ( ! isset( $this->mSkin ) ) {
                        wfProfileIn( __METHOD__ );
 
@@ -1672,7 +1674,7 @@ class User {
                // any matching rows
                if ( $watched ) {
                        $dbw =& wfGetDB( DB_MASTER );
-                       $success = $dbw->update( 'watchlist',
+                       $dbw->update( 'watchlist',
                                        array( /* SET */
                                                'wl_notificationtimestamp' => NULL
                                        ), array( /* WHERE */
@@ -1703,7 +1705,7 @@ class User {
                if( $currentUser != 0 )  {
 
                        $dbw =& wfGetDB( DB_MASTER );
-                       $success = $dbw->update( 'watchlist',
+                       $dbw->update( 'watchlist',
                                array( /* SET */
                                        'wl_notificationtimestamp' => NULL
                                ), array( /* WHERE */
@@ -1740,6 +1742,7 @@ class User {
                $this->mOptions = array();
                $a = explode( "\n", $str );
                foreach ( $a as $s ) {
+                       $m = array();
                        if ( preg_match( "/^(.[^=]*)=(.*)$/", $s, $m ) ) {
                                $this->mOptions[$m[1]] = $m[2];
                        }
@@ -1819,7 +1822,6 @@ class User {
         * Checks if a user with the given name exists, returns the ID
         */
        function idForName() {
-               $gotid = 0;
                $s = trim( $this->getName() );
                if ( 0 == strcmp( '', $s ) ) return 0;
 
index 6e66fc4..202f990 100644 (file)
@@ -270,8 +270,8 @@ class Xml {
                xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
 
                if( !xml_parse( $parser, $text, true ) ) {
-                       $err = xml_error_string( xml_get_error_code( $parser ) );
-                       $position = xml_get_current_byte_index( $parser );
+                       //$err = xml_error_string( xml_get_error_code( $parser ) );
+                       //$position = xml_get_current_byte_index( $parser );
                        //$fragment = $this->extractFragment( $html, $position );
                        //$this->mXmlError = "$err at byte $position:\n$fragment";
                        xml_parser_free( $parser );
index 0451ce8..9c9461d 100644 (file)
@@ -38,6 +38,7 @@ class ZhClient {
         */
        function connect() {
                wfSuppressWarnings();
+               $errno = $errstr = '';
                $this->mFP = fsockopen($this->mHost, $this->mPort, $errno, $errstr, 30);
                wfRestoreWarnings();
                if(!$this->mFP) {
@@ -115,7 +116,6 @@ class ZhClient {
                foreach($info as $variant) {
                        list($code, $len) = explode(' ', $variant);
                        $ret[strtolower($code)] = substr($data, $i, $len);
-                       $r = $ret[strtolower($code)];
                        $i+=$len;
                }
                return $ret;
index e12a256..c2dd93b 100644 (file)
@@ -154,7 +154,6 @@ abstract class ApiBase {
                                $replacement = '\\0' . "\n    " . 'http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/api/\\2';
                                
                                if (is_array($versions)) {
-                                       $ver2 = array();
                                        foreach ($versions as &$v)
                                                $v = eregi_replace($pattern, $replacement, $v);
                                        $versions = implode("\n  ", $versions);
index a2c75b9..b2a8bd8 100644 (file)
@@ -65,7 +65,7 @@ class ApiFeedWatchlist extends ApiBase {
                $data = $module->getResultData();
 
                $feedItems = array ();
-               foreach ($data['query']['watchlist'] as $index => $info) {
+               foreach ($data['query']['watchlist'] as $info) {
                        $feedItems[] = $this->createFeedItem($info);
                }
 
@@ -79,8 +79,6 @@ class ApiFeedWatchlist extends ApiBase {
        }
 
        private function createFeedItem($info) {
-               global $wgUser;
-
                $titleStr = $info['title'];
                $title = Title :: newFromText($titleStr);
                $titleUrl = $title->getFullUrl();
index 05a39e2..1ec8af4 100644 (file)
      * @param string $line A line from the YAML file
      */
     function _getIndent($line) {
+      $match = array();
       preg_match('/^\s{1,}/',$line,$match);
       if (!empty($match[0])) {
         $indent = substr_count($match[0],' ');
       } elseif (preg_match('/^(.+):/',$line,$key)) {
         // It's a key/value pair most likely
         // If the key is in double quotes pull it out
+        $matches = array();
         if (preg_match('/^(["\'](.*)["\'](\s)*:)/',$line,$matches)) {
           $value = trim(str_replace($matches[1],'',$line));
           $key   = $matches[2];
      * @return mixed
      */
     function _toType($value) {
+      $matches = array();
       if (preg_match('/^("(.*)"|\'(.*)\')/',$value,$matches)) {        
        $value = (string)preg_replace('/(\'\'|\\\\\')/',"'",end($matches));
        $value = preg_replace('/\\\\"/','"',$value);
       
       // Check for strings      
       $regex = '/(?:(")|(?:\'))((?(1)[^"]+|[^\']+))(?(1)"|\')/';
+      $strings = array();
       if (preg_match_all($regex,$inline,$strings)) {
         $saved_strings[] = $strings[0][0];
         $inline  = preg_replace($regex,'YAMLString',$inline); 
       unset($regex);
 
       // Check for sequences
+      $seqs = array();
       if (preg_match_all('/\[(.+)\]/U',$inline,$seqs)) {
         $inline = preg_replace('/\[(.+)\]/U','YAMLSeq',$inline);
         $seqs   = $seqs[0];
       }
       
       // Check for mappings
+      $maps = array();
       if (preg_match_all('/{(.+)}/U',$inline,$maps)) {
         $inline = preg_replace('/{(.+)}/U','YAMLMap',$inline);
         $maps   = $maps[0];
     function _linkRef(&$n,$key,$k = NULL,$v = NULL) {
       if (empty($k) && empty($v)) {
         // Look for &refs
+        $matches = array();
         if (preg_match('/^&([^ ]+)/',$n->data[$key],$matches)) {
           // Flag the node so we know it's a reference
           $this->_allNodes[$n->id]->ref = substr($matches[0],1);
       $ret   = array(); 
 
       foreach($keys as $key) { 
-        list($unused,$val) = each($vals);
+        list( /* unused */ ,$val) = each($vals);
         // This is the good part!  If a key already exists, but it's part of a
         // sequence (an int), just keep addin numbers until we find a fresh one.
         if (isset($ret[$key]) and is_int($key)) {
index e93fc61..697399c 100644 (file)
@@ -296,7 +296,7 @@ class ApiMain extends ApiBase {
 
                $astriks = str_repeat('*** ', 10);
                $msg .= "\n\n$astriks Modules  $astriks\n\n";
-               foreach ($this->mModules as $moduleName => $moduleClass) {
+               foreach( array_keys($this->mModules) as $moduleName ) {
                        $msg .= "* action=$moduleName *";
                        $module = new $this->mModules[$moduleName] ($this, $moduleName);
                        $msg2 = $module->makeHelpMsg();
@@ -306,7 +306,7 @@ class ApiMain extends ApiBase {
                }
 
                $msg .= "\n$astriks Formats  $astriks\n\n";
-               foreach ($this->mFormats as $formatName => $moduleClass) {
+               foreach( array_keys($this->mFormats) as $formatName ) {
                        $msg .= "* format=$formatName *";
                        $module = $this->createPrinterByName($formatName);
                        $msg2 = $module->makeHelpMsg();
index 19b30b1..3bbcf4e 100644 (file)
@@ -68,7 +68,7 @@ class ApiOpenSearch extends ApiBase {
 
                // Reformat useful data for future printing by JSON engine
                $srchres = array ();
-               foreach ($data['query']['allpages'] as $pageid => & $pageinfo) {
+               foreach ($data['query']['allpages'] as & $pageinfo) {
                        // Note: this data will no be printable by the xml engine
                        // because it does not support lists of unnamed items
                        $srchres[] = $pageinfo['title'];
index b5424bb..3b8e15a 100644 (file)
@@ -382,7 +382,7 @@ class ApiPageSet extends ApiQueryBase {
                        if($processTitles) {
                                // The remaining titles in $remaining are non-existant pages
                                foreach ($remaining as $ns => $dbkeys) {
-                                       foreach ($dbkeys as $dbkey => $nothing) {
+                                       foreach ( array_keys($dbkeys) as $dbkey ) {
                                                $title = Title :: makeTitle($ns, $dbkey);
                                                $this->mMissingTitles[] = $title;
                                                $this->mAllPages[$ns][$dbkey] = 0;
index 46abcda..9b5b0a7 100644 (file)
@@ -53,7 +53,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                wfProfileOut($this->getModuleProfileName() . '-getDB');
 
                wfProfileIn($this->getModuleProfileName() . '-parseParams');
-               $limit = $from = $namespace = $filterredir = null;
+               $limit = $from = $namespace = $filterredir = $prefix = null;
                extract($this->extractRequestParams());
 
                $this->addTables('page');
index 2c171f8..c875df3 100644 (file)
@@ -185,7 +185,6 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                        $this->parseContinueParam($continue, $redirect);
 
                        // Skip all completed links
-                       $db = & $this->getDB();
 
                } else {
                        if ($count !== 1)
index 93b4d08..0890689 100644 (file)
@@ -52,7 +52,7 @@ class ApiQueryInfo extends ApiQueryBase {
                $pageTouched = $pageSet->getCustomField('page_touched');
                $pageLatest = $pageSet->getCustomField('page_latest');
 
-               foreach ($titles as $pageid => $title) {
+               foreach ( array_keys($titles) as $pageid) {
                        $pageInfo = array (
                                'touched' => wfTimestamp(TS_ISO_8601, $pageTouched[$pageid]),
                                'lastrevid' => intval($pageLatest[$pageid])
index 7c3a90a..a25a4e0 100644 (file)
@@ -36,7 +36,7 @@ class ApiQueryRecentChanges extends ApiQueryBase {
        }
 
        public function execute() {
-               $limit = $prop = $from = $namespace = $show = $dir = $start = $end = null;
+               $limit = $prop = $namespace = $show = $dir = $start = $end = null;
                extract($this->extractRequestParams());
 
                $this->addTables('recentchanges');
index 1d8ae69..65e5737 100644 (file)
@@ -99,16 +99,19 @@ class ApiQueryContributions extends ApiQueryBase {
 
                        //If we got data on the revision only, use only
                        // that data.
-                       if($revvals && !$pagevals)
+                       if($revvals && !$pagevals) {
                                $data[] = $revvals;
+                       }
                        //If we got data on the page only, use only
                        // that data.
-                       else if($pagevals && !$revvals)
+                       else if($pagevals && !$revvals) {
                                $data[] = $pagevals;
+                       }
                        //... and if we got data on both the revision and
                        // the page, merge the data and send it out.
-                       else if($pagevals && $revvals)
+                       else if($pagevals && $revvals) {
                                $data[] = array_merge($revvals, $pagevals);
+                       }
                }
 
                //Free the database record so the connection can get on with other stuff
index 595cb75..dbe01c9 100644 (file)
@@ -59,7 +59,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
                        $user = (false !== array_search('user', $prop));
                        $comment = (false !== array_search('comment', $prop));
-                       $timestamp = (false !== array_search('timestamp', $prop));
+                       $timestamp = (false !== array_search('timestamp', $prop)); // TODO: $timestamp not currently being used.
                        $patrol = (false !== array_search('patrol', $prop));
 
                        if ($patrol) {
index 4ef8ee4..59088be 100644 (file)
@@ -75,7 +75,6 @@ class CBTCompiler {
         * Returns true on success, error message on failure
         */
        function compile() {
-               $fname = 'CBTProcessor::compile';
                $this->mLastError = false;
                $this->mOps = array();
 
@@ -222,7 +221,6 @@ class CBTCompiler {
                        if ( $char == '{' ) {
                                // Switch to text mode
                                ++$p;
-                               $tokenStart = $p;
                                $this->doOpenText( $p, $end );
                                ++$argCount;
                        } elseif ( $char == '}' ) {
@@ -292,7 +290,7 @@ class CBTCompiler {
                wfProfileIn( $fname );
                $stack = array();
 
-               foreach( $this->mOps as $index => $op ) {
+               foreach( $this->mOps as $op ) {
                        switch( $op->opcode ) {
                                case CBT_PUSH:
                                        $stack[] = $this->phpQuote( $op->arg1 );
index e260136..b86ab7c 100644 (file)
@@ -68,6 +68,7 @@ function showDiffs( $a, $b ) {
        $diffs = new Diff( $ota, $nta );
        $formatter = new TableDiffFormatter();
        $funky = $formatter->format( $diffs );
+       $matches = array();
        preg_match_all( '/<span class="diffchange">(.*?)<\/span>/', $funky, $matches );
        foreach( $matches[1] as $bit ) {
                $hex = bin2hex( $bit );
index 7106959..34ab69c 100644 (file)
@@ -45,6 +45,7 @@ if( !$in ) {
 
 $columns = 0;
 while( false !== ( $line = fgets( $in ) ) ) {
+       $matches = array();
        if( preg_match( '/^(Here come the tests:\s*)\|$/', $line, $matches ) ) {
                $columns = strpos( $line, '|' );
                break;
@@ -86,6 +87,7 @@ $failed = 0;
 $success = 0;
 $total = 0;
 while( false !== ( $line = fgets( $in ) ) ) {
+       $matches = array();
        if( preg_match( '/^(\d+)\s+(.*?)\s*\|/', $line, $matches ) ) {
                $section = $matches[1];
                print $line;
index ae1f865..d8eac7b 100644 (file)
@@ -224,8 +224,7 @@ class UtfNormal {
         * @static
         */
        static function loadData() {
-               # fixme : are $utfCanonicalComp, $utfCanonicalDecomp really used?
-               global $utfCombiningClass, $utfCanonicalComp, $utfCanonicalDecomp;
+               global $utfCombiningClass;
                if( !isset( $utfCombiningClass ) ) {
                        require_once( 'UtfNormalData.inc' );
                }
@@ -329,6 +328,7 @@ class UtfNormal {
                # large ASCII parts can be handled much more quickly.
                # Don't chop up Unicode areas for punctuation, though,
                # that wastes energy.
+               $matches = array();
                preg_match_all(
                        '/([\x00-\x7f]+|[\x80-\xff][\x00-\x40\x5b-\x5f\x7b-\xff]*)/',
                        $string, $matches );
@@ -551,7 +551,7 @@ class UtfNormal {
         * @return string a UTF-8 string decomposed, not yet normalized (needs sorting)
         * @static
         */
-       static function fastDecompose( $string, &$map ) {
+       static function fastDecompose( $string, $map ) {
                UtfNormal::loadData();
                $len = strlen( $string );
                $out = '';
index 688a80f..f0eb533 100644 (file)
@@ -43,6 +43,7 @@ if( !$in ) {
 print "Initializing normalization quick check tables...\n";
 $checkNFC = array();
 while( false !== ($line = fgets( $in ) ) ) {
+       $matches = array();
        if( preg_match( '/^([0-9A-F]+)(?:..([0-9A-F]+))?\s*;\s*(NFC_QC)\s*;\s*([MN])/', $line, $matches ) ) {
                list( $junk, $first, $last, $prop, $value ) = $matches;
                #print "$first $last $prop $value\n";
index 6d95bf8..1181b63 100644 (file)
@@ -73,6 +73,7 @@ $testedChars = array();
 while( false !== ( $line = fgets( $in ) ) ) {
        list( $data, $comment ) = explode( '#', $line );
        if( $data === '' ) continue;
+       $matches = array();
        if( preg_match( '/@Part([\d])/', $data, $matches ) ) {
                if( $matches[1] > 0 ) {
                        $ok = reportResults( $total, $success, $failure ) && $ok;
@@ -236,7 +237,6 @@ function testInvariant( &$u, $char, $desc, $reportFailure = false ) {
        $result = verbosify( $char, $u->toNFD( $char ), 1, 'NFD', $reportFailure ) && $result;
        $result = verbosify( $char, $u->toNFKC( $char ), 1, 'NFKC', $reportFailure ) && $result;
        $result = verbosify( $char, $u->toNFKD( $char ), 1, 'NFKD', $reportFailure ) && $result;
-       $c = $char;
        $result = verbosify( $char, $u->cleanUp( $char ), 1, 'cleanUp', $reportFailure ) && $result;
        global $verbose;
        if( $verbose && !$result && !$reportFailure ) {