r17880 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17879‎ | r17880 | r17881 >
Date:08:25, 23 November 2006
Author:nickj
Status:old
Tags:
Comment:
Code housekeeping stuff (and barring any stuff-ups on my behalf, there should be no changes in behaviour whatsoever after this) -
* 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.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/DatabaseFunctions.php (modified) (history)
  • /trunk/phase3/includes/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Exif.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/Licenses.php (modified) (history)
  • /trunk/phase3/includes/LinkBatch.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/MessageCache.php (modified) (history)
  • /trunk/phase3/includes/MimeMagic.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/Profiler.php (modified) (history)
  • /trunk/phase3/includes/ProtectionForm.php (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/Sanitizer.php (modified) (history)
  • /trunk/phase3/includes/SearchEngine.php (modified) (history)
  • /trunk/phase3/includes/SearchPostgres.php (modified) (history)
  • /trunk/phase3/includes/SpecialAllpages.php (modified) (history)
  • /trunk/phase3/includes/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/includes/SpecialContributions.php (modified) (history)
  • /trunk/phase3/includes/SpecialImport.php (modified) (history)
  • /trunk/phase3/includes/SpecialMovepage.php (modified) (history)
  • /trunk/phase3/includes/SpecialNewimages.php (modified) (history)
  • /trunk/phase3/includes/SpecialRecentchanges.php (modified) (history)
  • /trunk/phase3/includes/SpecialRecentchangeslinked.php (modified) (history)
  • /trunk/phase3/includes/SpecialRevisiondelete.php (modified) (history)
  • /trunk/phase3/includes/SpecialSearch.php (modified) (history)
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/includes/SpecialUserrights.php (modified) (history)
  • /trunk/phase3/includes/SpecialWatchlist.php (modified) (history)
  • /trunk/phase3/includes/SpecialWhatlinkshere.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/Xml.php (modified) (history)
  • /trunk/phase3/includes/ZhClient.php (modified) (history)
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFeedWatchlist.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatYaml_spyc.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)
  • /trunk/phase3/includes/api/ApiOpenSearch.php (modified) (history)
  • /trunk/phase3/includes/api/ApiPageSet.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllpages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBacklinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)
  • /trunk/phase3/includes/cbt/CBTCompiler.php (modified) (history)
  • /trunk/phase3/includes/normal/RandomTest.php (modified) (history)
  • /trunk/phase3/includes/normal/Utf8Test.php (modified) (history)
  • /trunk/phase3/includes/normal/UtfNormal.php (modified) (history)
  • /trunk/phase3/includes/normal/UtfNormalGenerate.php (modified) (history)
  • /trunk/phase3/includes/normal/UtfNormalTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialImport.php
@@ -208,7 +208,7 @@
209209 $dbw = wfGetDB( DB_MASTER );
210210 $nullRevision = Revision::newNullRevision(
211211 $dbw, $title->getArticleId(), $comment, true );
212 - $nullRevId = $nullRevision->insertOn( $dbw );
 212+ $nullRevision->insertOn( $dbw );
213213 }
214214 }
215215
@@ -304,7 +304,6 @@
305305 }
306306
307307 function importOldRevision() {
308 - $fname = "WikiImporter::importOldRevision";
309308 $dbw =& wfGetDB( DB_MASTER );
310309
311310 # Sneak a single revision into place
Index: trunk/phase3/includes/SpecialMovepage.php
@@ -9,7 +9,7 @@
1010 * Constructor
1111 */
1212 function wfSpecialMovepage( $par = null ) {
13 - global $wgUser, $wgOut, $wgRequest, $action, $wgOnlySysopMayMove;
 13+ global $wgUser, $wgOut, $wgRequest, $action;
1414
1515 # Check rights
1616 if ( !$wgUser->isAllowed( 'move' ) ) {
@@ -189,7 +189,6 @@
190190
191191 function doSubmit() {
192192 global $wgOut, $wgUser, $wgRequest;
193 - $fname = "MovePageForm::doSubmit";
194193
195194 if ( $wgUser->pingLimiter( 'move' ) ) {
196195 $wgOut->rateLimited();
Index: trunk/phase3/includes/SpecialRevisiondelete.php
@@ -10,12 +10,11 @@
1111 */
1212
1313 function wfSpecialRevisiondelete( $par = null ) {
14 - global $wgOut, $wgRequest, $wgUser;
 14+ global $wgOut, $wgRequest;
1515
1616 $target = $wgRequest->getVal( 'target' );
1717 $oldid = $wgRequest->getIntArray( 'oldid' );
1818
19 - $sk = $wgUser->getSkin();
2019 $page = Title::newFromUrl( $target );
2120
2221 if( is_null( $page ) ) {
@@ -156,7 +155,7 @@
157156 function extractBitfield( $request ) {
158157 $bitfield = 0;
159158 foreach( $this->checks as $item ) {
160 - list( $message, $name, $field ) = $item;
 159+ list( /* message */ , $name, $field ) = $item;
161160 if( $request->getCheck( $name ) ) {
162161 $bitfield |= $field;
163162 }
@@ -167,7 +166,7 @@
168167 function save( $bitfield, $reason ) {
169168 $dbw = wfGetDB( DB_MASTER );
170169 $deleter = new RevisionDeleter( $dbw );
171 - $ok = $deleter->setVisibility( $this->revisions, $bitfield, $reason );
 170+ $deleter->setVisibility( $this->revisions, $bitfield, $reason );
172171 }
173172 }
174173
Index: trunk/phase3/includes/api/ApiQueryInfo.php
@@ -52,7 +52,7 @@
5353 $pageTouched = $pageSet->getCustomField('page_touched');
5454 $pageLatest = $pageSet->getCustomField('page_latest');
5555
56 - foreach ($titles as $pageid => $title) {
 56+ foreach ( array_keys($titles) as $pageid) {
5757 $pageInfo = array (
5858 'touched' => wfTimestamp(TS_ISO_8601, $pageTouched[$pageid]),
5959 'lastrevid' => intval($pageLatest[$pageid])
Index: trunk/phase3/includes/api/ApiMain.php
@@ -296,7 +296,7 @@
297297
298298 $astriks = str_repeat('*** ', 10);
299299 $msg .= "\n\n$astriks Modules $astriks\n\n";
300 - foreach ($this->mModules as $moduleName => $moduleClass) {
 300+ foreach( array_keys($this->mModules) as $moduleName ) {
301301 $msg .= "* action=$moduleName *";
302302 $module = new $this->mModules[$moduleName] ($this, $moduleName);
303303 $msg2 = $module->makeHelpMsg();
@@ -306,7 +306,7 @@
307307 }
308308
309309 $msg .= "\n$astriks Formats $astriks\n\n";
310 - foreach ($this->mFormats as $formatName => $moduleClass) {
 310+ foreach( array_keys($this->mFormats) as $formatName ) {
311311 $msg .= "* format=$formatName *";
312312 $module = $this->createPrinterByName($formatName);
313313 $msg2 = $module->makeHelpMsg();
Index: trunk/phase3/includes/api/ApiFeedWatchlist.php
@@ -65,7 +65,7 @@
6666 $data = $module->getResultData();
6767
6868 $feedItems = array ();
69 - foreach ($data['query']['watchlist'] as $index => $info) {
 69+ foreach ($data['query']['watchlist'] as $info) {
7070 $feedItems[] = $this->createFeedItem($info);
7171 }
7272
@@ -79,8 +79,6 @@
8080 }
8181
8282 private function createFeedItem($info) {
83 - global $wgUser;
84 -
8583 $titleStr = $info['title'];
8684 $title = Title :: newFromText($titleStr);
8785 $titleUrl = $title->getFullUrl();
Index: trunk/phase3/includes/api/ApiOpenSearch.php
@@ -68,7 +68,7 @@
6969
7070 // Reformat useful data for future printing by JSON engine
7171 $srchres = array ();
72 - foreach ($data['query']['allpages'] as $pageid => & $pageinfo) {
 72+ foreach ($data['query']['allpages'] as & $pageinfo) {
7373 // Note: this data will no be printable by the xml engine
7474 // because it does not support lists of unnamed items
7575 $srchres[] = $pageinfo['title'];
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php
@@ -185,7 +185,6 @@
186186 $this->parseContinueParam($continue, $redirect);
187187
188188 // Skip all completed links
189 - $db = & $this->getDB();
190189
191190 } else {
192191 if ($count !== 1)
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php
@@ -99,16 +99,19 @@
100100
101101 //If we got data on the revision only, use only
102102 // that data.
103 - if($revvals && !$pagevals)
 103+ if($revvals && !$pagevals) {
104104 $data[] = $revvals;
 105+ }
105106 //If we got data on the page only, use only
106107 // that data.
107 - else if($pagevals && !$revvals)
 108+ else if($pagevals && !$revvals) {
108109 $data[] = $pagevals;
 110+ }
109111 //... and if we got data on both the revision and
110112 // the page, merge the data and send it out.
111 - else if($pagevals && $revvals)
 113+ else if($pagevals && $revvals) {
112114 $data[] = array_merge($revvals, $pagevals);
 115+ }
113116 }
114117
115118 //Free the database record so the connection can get on with other stuff
Index: trunk/phase3/includes/api/ApiPageSet.php
@@ -382,7 +382,7 @@
383383 if($processTitles) {
384384 // The remaining titles in $remaining are non-existant pages
385385 foreach ($remaining as $ns => $dbkeys) {
386 - foreach ($dbkeys as $dbkey => $nothing) {
 386+ foreach ( array_keys($dbkeys) as $dbkey ) {
387387 $title = Title :: makeTitle($ns, $dbkey);
388388 $this->mMissingTitles[] = $title;
389389 $this->mAllPages[$ns][$dbkey] = 0;
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -59,7 +59,7 @@
6060
6161 $user = (false !== array_search('user', $prop));
6262 $comment = (false !== array_search('comment', $prop));
63 - $timestamp = (false !== array_search('timestamp', $prop));
 63+ $timestamp = (false !== array_search('timestamp', $prop)); // TODO: $timestamp not currently being used.
6464 $patrol = (false !== array_search('patrol', $prop));
6565
6666 if ($patrol) {
Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -36,7 +36,7 @@
3737 }
3838
3939 public function execute() {
40 - $limit = $prop = $from = $namespace = $show = $dir = $start = $end = null;
 40+ $limit = $prop = $namespace = $show = $dir = $start = $end = null;
4141 extract($this->extractRequestParams());
4242
4343 $this->addTables('recentchanges');
Index: trunk/phase3/includes/api/ApiFormatYaml_spyc.php
@@ -463,6 +463,7 @@
464464 * @param string $line A line from the YAML file
465465 */
466466 function _getIndent($line) {
 467+ $match = array();
467468 preg_match('/^\s{1,}/',$line,$match);
468469 if (!empty($match[0])) {
469470 $indent = substr_count($match[0],' ');
@@ -500,6 +501,7 @@
501502 } elseif (preg_match('/^(.+):/',$line,$key)) {
502503 // It's a key/value pair most likely
503504 // If the key is in double quotes pull it out
 505+ $matches = array();
504506 if (preg_match('/^(["\'](.*)["\'](\s)*:)/',$line,$matches)) {
505507 $value = trim(str_replace($matches[1],'',$line));
506508 $key = $matches[2];
@@ -529,6 +531,7 @@
530532 * @return mixed
531533 */
532534 function _toType($value) {
 535+ $matches = array();
533536 if (preg_match('/^("(.*)"|\'(.*)\')/',$value,$matches)) {
534537 $value = (string)preg_replace('/(\'\'|\\\\\')/',"'",end($matches));
535538 $value = preg_replace('/\\\\"/','"',$value);
@@ -596,6 +599,7 @@
597600
598601 // Check for strings
599602 $regex = '/(?:(")|(?:\'))((?(1)[^"]+|[^\']+))(?(1)"|\')/';
 603+ $strings = array();
600604 if (preg_match_all($regex,$inline,$strings)) {
601605 $saved_strings[] = $strings[0][0];
602606 $inline = preg_replace($regex,'YAMLString',$inline);
@@ -603,12 +607,14 @@
604608 unset($regex);
605609
606610 // Check for sequences
 611+ $seqs = array();
607612 if (preg_match_all('/\[(.+)\]/U',$inline,$seqs)) {
608613 $inline = preg_replace('/\[(.+)\]/U','YAMLSeq',$inline);
609614 $seqs = $seqs[0];
610615 }
611616
612617 // Check for mappings
 618+ $maps = array();
613619 if (preg_match_all('/{(.+)}/U',$inline,$maps)) {
614620 $inline = preg_replace('/{(.+)}/U','YAMLMap',$inline);
615621 $maps = $maps[0];
@@ -704,6 +710,7 @@
705711 function _linkRef(&$n,$key,$k = NULL,$v = NULL) {
706712 if (empty($k) && empty($v)) {
707713 // Look for &refs
 714+ $matches = array();
708715 if (preg_match('/^&([^ ]+)/',$n->data[$key],$matches)) {
709716 // Flag the node so we know it's a reference
710717 $this->_allNodes[$n->id]->ref = substr($matches[0],1);
@@ -837,7 +844,7 @@
838845 $ret = array();
839846
840847 foreach($keys as $key) {
841 - list($unused,$val) = each($vals);
 848+ list( /* unused */ ,$val) = each($vals);
842849 // This is the good part! If a key already exists, but it's part of a
843850 // sequence (an int), just keep addin numbers until we find a fresh one.
844851 if (isset($ret[$key]) and is_int($key)) {
Index: trunk/phase3/includes/api/ApiBase.php
@@ -154,7 +154,6 @@
155155 $replacement = '\\0' . "\n " . 'http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/api/\\2';
156156
157157 if (is_array($versions)) {
158 - $ver2 = array();
159158 foreach ($versions as &$v)
160159 $v = eregi_replace($pattern, $replacement, $v);
161160 $versions = implode("\n ", $versions);
Index: trunk/phase3/includes/api/ApiQueryAllpages.php
@@ -53,7 +53,7 @@
5454 wfProfileOut($this->getModuleProfileName() . '-getDB');
5555
5656 wfProfileIn($this->getModuleProfileName() . '-parseParams');
57 - $limit = $from = $namespace = $filterredir = null;
 57+ $limit = $from = $namespace = $filterredir = $prefix = null;
5858 extract($this->extractRequestParams());
5959
6060 $this->addTables('page');
Index: trunk/phase3/includes/OutputPage.php
@@ -243,7 +243,7 @@
244244 $lb->execute();
245245
246246 $sk =& $wgUser->getSkin();
247 - foreach ( $categories as $category => $arbitrary ) {
 247+ foreach ( array_keys($categories) as $category ) {
248248 $title = Title::makeTitleSafe( NS_CATEGORY, $category );
249249 $text = $wgContLang->convertHtml( $title->getText() );
250250 $this->mCategoryLinks[] = $sk->makeLinkObj( $title, $text );
@@ -512,7 +512,7 @@
513513 public function output() {
514514 global $wgUser, $wgOutputEncoding, $wgRequest;
515515 global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType;
516 - global $wgJsMimeType, $wgStylePath, $wgUseAjax, $wgAjaxSearch, $wgScriptPath, $wgServer;
 516+ global $wgJsMimeType, $wgStylePath, $wgUseAjax, $wgAjaxSearch, $wgServer;
517517 global $wgStyleVersion;
518518
519519 if( $this->mDoNothing ){
@@ -1010,8 +1010,8 @@
10111011 if ( !is_array( $links2d ) ) {
10121012 return;
10131013 }
1014 - foreach ( $links2d as $ns => $dbkeys ) {
1015 - foreach( $dbkeys as $dbkey => $id ) {
 1014+ foreach ( $links2d as $dbkeys ) {
 1015+ foreach( array_keys($dbkeys) as $dbkey ) {
10161016 $this->addKeyword( $dbkey );
10171017 if ( ++$count > 10 ) {
10181018 break 2;
Index: trunk/phase3/includes/Xml.php
@@ -270,8 +270,8 @@
271271 xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
272272
273273 if( !xml_parse( $parser, $text, true ) ) {
274 - $err = xml_error_string( xml_get_error_code( $parser ) );
275 - $position = xml_get_current_byte_index( $parser );
 274+ //$err = xml_error_string( xml_get_error_code( $parser ) );
 275+ //$position = xml_get_current_byte_index( $parser );
276276 //$fragment = $this->extractFragment( $html, $position );
277277 //$this->mXmlError = "$err at byte $position:\n$fragment";
278278 xml_parser_free( $parser );
Index: trunk/phase3/includes/Licenses.php
@@ -63,12 +63,14 @@
6464 $obj = new License( $line );
6565 $this->stackItem( $this->licenses, $levels, $obj );
6666 } else {
67 - if ( $level < count( $levels ) )
 67+ if ( $level < count( $levels ) ) {
6868 $levels = array_slice( $levels, 0, $level );
69 - if ( $level == count( $levels ) )
 69+ }
 70+ if ( $level == count( $levels ) ) {
7071 $levels[$level - 1] = $line;
71 - else if ( $level > count( $levels ) )
 72+ } else if ( $level > count( $levels ) ) {
7273 $levels[] = $line;
 74+ }
7375 }
7476 }
7577 }
Index: trunk/phase3/includes/SpecialUserlogin.php
@@ -177,7 +177,6 @@
178178 } else {
179179 # Confirm that the account was created
180180 global $wgOut;
181 - $skin = $wgUser->getSkin();
182181 $self = SpecialPage::getTitleFor( 'Userlogin' );
183182 $wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) );
184183 $wgOut->setArticleRelated( false );
Index: trunk/phase3/includes/SpecialUpload.php
@@ -106,7 +106,7 @@
107107 * @access private
108108 */
109109 function initializeFromUrl( $request ) {
110 - global $wgTmpDirectory, $wgMaxUploadSize;
 110+ global $wgTmpDirectory;
111111 $url = $request->getText( 'wpUploadFileURL' );
112112 $local_file = tempnam( $wgTmpDirectory, 'WEBUPLOAD' );
113113
@@ -126,7 +126,7 @@
127127 * Returns true if there was an error, false otherwise
128128 */
129129 private function curlCopy( $url, $dest ) {
130 - global $wgMaxUploadSize, $wgUser, $wgOut;
 130+ global $wgUser, $wgOut;
131131
132132 if( !$wgUser->isAllowed( 'upload_by_url' ) ) {
133133 $wgOut->permissionRequired( 'upload_by_url' );
@@ -704,9 +704,7 @@
705705 $wgOut->addHTML( '<div id="uploadtext">' );
706706 $wgOut->addWikiText( wfMsg( 'uploadtext' ) );
707707 $wgOut->addHTML( '</div>' );
708 - $sk = $wgUser->getSkin();
709708
710 -
711709 $sourcefilename = wfMsgHtml( 'sourcefilename' );
712710 $destfilename = wfMsgHtml( 'destfilename' );
713711 $summary = wfMsgWikiHtml( 'fileuploadsummary' );
@@ -732,7 +730,6 @@
733731
734732 // Prepare form for upload or upload/copy
735733 if( $wgAllowCopyUploads && $wgUser->isAllowed( 'upload_by_url' ) ) {
736 - $source_comment = wfMsgHtml( 'upload_source_url' );
737734 $filename_form =
738735 "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked />" .
739736 "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' onfocus='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" .
@@ -1055,13 +1052,13 @@
10561053 $chunk = Sanitizer::decodeCharReferences( $chunk );
10571054
10581055 #look for script-types
1059 - if (preg_match("!type\s*=\s*['\"]?\s*(\w*/)?(ecma|java)!sim",$chunk)) return true;
 1056+ if (preg_match('!type\s*=\s*[\'"]?\s*(\w*/)?(ecma|java)!sim',$chunk)) return true;
10601057
10611058 #look for html-style script-urls
1062 - if (preg_match("!(href|src|data)\s*=\s*['\"]?\s*(ecma|java)script:!sim",$chunk)) return true;
 1059+ if (preg_match('!(href|src|data)\s*=\s*[\'"]?\s*(ecma|java)script:!sim',$chunk)) return true;
10631060
10641061 #look for css-style script-urls
1065 - if (preg_match("!url\s*\(\s*['\"]?\s*(ecma|java)script:!sim",$chunk)) return true;
 1062+ if (preg_match('!url\s*\(\s*[\'"]?\s*(ecma|java)script:!sim',$chunk)) return true;
10661063
10671064 wfDebug("SpecialUpload::detectScript: no scripts found\n");
10681065 return false;
@@ -1113,21 +1110,25 @@
11141111 #NOTE: there's a 50 line workaround to make stderr redirection work on windows, too.
11151112 # that does not seem to be worth the pain.
11161113 # Ask me (Duesentrieb) about it if it's ever needed.
 1114+ $output = array();
11171115 if (wfIsWindows()) exec("$scanner",$output,$code);
11181116 else exec("$scanner 2>&1",$output,$code);
11191117
1120 - $exit_code= $code; #remeber for user feedback
 1118+ $exit_code= $code; #remember for user feedback
11211119
11221120 if ($virus_scanner_codes) { #map exit code to AV_xxx constants.
1123 - if (isset($virus_scanner_codes[$code])) $code= $virus_scanner_codes[$code]; #explicite mapping
1124 - else if (isset($virus_scanner_codes["*"])) $code= $virus_scanner_codes["*"]; #fallback mapping
 1121+ if (isset($virus_scanner_codes[$code])) {
 1122+ $code= $virus_scanner_codes[$code]; # explicit mapping
 1123+ } else if (isset($virus_scanner_codes["*"])) {
 1124+ $code= $virus_scanner_codes["*"]; # fallback mapping
 1125+ }
11251126 }
11261127
11271128 if ($code===AV_SCAN_FAILED) { #scan failed (code was mapped to false by $virus_scanner_codes)
11281129 wfDebug("$fname: failed to scan $file (code $exit_code).\n");
11291130
1130 - if ($wgAntivirusRequired) return "scan failed (code $exit_code)";
1131 - else return NULL;
 1131+ if ($wgAntivirusRequired) { return "scan failed (code $exit_code)"; }
 1132+ else { return NULL; }
11321133 }
11331134 else if ($code===AV_SCAN_ABORTED) { #scan failed because filetype is unknown (probably imune)
11341135 wfDebug("$fname: unsupported file type $file (code $exit_code).\n");
@@ -1141,7 +1142,7 @@
11421143 $output= join("\n",$output);
11431144 $output= trim($output);
11441145
1145 - if (!$output) $output= true; #if ther's no output, return true
 1146+ if (!$output) $output= true; #if there's no output, return true
11461147 else if ($msg_pattern) {
11471148 $groups= array();
11481149 if (preg_match($msg_pattern,$output,$groups)) {
Index: trunk/phase3/includes/DatabaseOracle.php
@@ -55,9 +55,6 @@
5656 $this->mPassword = $password;
5757 $this->mDBname = $dbName;
5858
59 - $success = false;
60 -
61 - $hstring="";
6259 $this->mConn = oci_new_connect($user, $password, $dbName, "AL32UTF8");
6360 if ( $this->mConn === false ) {
6461 wfDebug( "DB connection error\n" );
@@ -147,7 +144,6 @@
148145
149146 for ($i = 1; $i <= $this->mNcols[$res]; $i++) {
150147 $name = $this->mFieldNames[$res][$i];
151 - $type = $this->mFieldTypes[$res][$i];
152148 if (isset($this->mFetchCache[$res][$this->mFetchID[$res]][$name]))
153149 $value = $this->mFetchCache[$res][$this->mFetchID[$res]][$name];
154150 else $value = NULL;
@@ -165,7 +161,7 @@
166162 return false;
167163 $i = 0;
168164 $ret = array();
169 - foreach ($r as $key => $value) {
 165+ foreach ($r as $value) {
170166 wfdebug("ret[$i]=[$value]\n");
171167 $ret[$i++] = $value;
172168 }
@@ -201,14 +197,19 @@
202198
203199 function lastError() {
204200 if ($this->mErr === false) {
205 - if ($this->mLastResult !== false) $what = $this->mLastResult;
206 - else if ($this->mConn !== false) $what = $this->mConn;
207 - else $what = false;
 201+ if ($this->mLastResult !== false) {
 202+ $what = $this->mLastResult;
 203+ } else if ($this->mConn !== false) {
 204+ $what = $this->mConn;
 205+ } else {
 206+ $what = false;
 207+ }
208208 $err = ($what !== false) ? oci_error($what) : oci_error();
209 - if ($err === false)
 209+ if ($err === false) {
210210 $this->mErr = 'no error';
211 - else
 211+ } else {
212212 $this->mErr = $err['message'];
 213+ }
213214 }
214215 return str_replace("\n", '<br />', $this->mErr);
215216 }
Index: trunk/phase3/includes/ProtectionForm.php
@@ -130,7 +130,7 @@
131131 $out .= "<table id='mwProtectSet'>";
132132 $out .= "<tbody>";
133133 $out .= "<tr>\n";
134 - foreach( $this->mRestrictions as $action => $required ) {
 134+ foreach( array_keys($this->mRestrictions) as $action ) {
135135 /* Not all languages have V_x <-> N_x relation */
136136 $out .= "<th>" . wfMsgHtml( 'restriction-' . $action ) . "</th>\n";
137137 }
Index: trunk/phase3/includes/ZhClient.php
@@ -38,6 +38,7 @@
3939 */
4040 function connect() {
4141 wfSuppressWarnings();
 42+ $errno = $errstr = '';
4243 $this->mFP = fsockopen($this->mHost, $this->mPort, $errno, $errstr, 30);
4344 wfRestoreWarnings();
4445 if(!$this->mFP) {
@@ -115,7 +116,6 @@
116117 foreach($info as $variant) {
117118 list($code, $len) = explode(' ', $variant);
118119 $ret[strtolower($code)] = substr($data, $i, $len);
119 - $r = $ret[strtolower($code)];
120120 $i+=$len;
121121 }
122122 return $ret;
Index: trunk/phase3/includes/EditPage.php
@@ -571,6 +571,7 @@
572572 $this->mMetaData = '' ;
573573
574574 # Check for spam
 575+ $matches = array();
575576 if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1, $matches ) ) {
576577 $this->spamPage ( $matches[0] );
577578 wfProfileOut( "$fname-checks" );
@@ -858,6 +859,7 @@
859860 $s = wfMsg('editingcomment', $this->mTitle->getPrefixedText() );
860861 } else {
861862 $s = wfMsg('editingsection', $this->mTitle->getPrefixedText() );
 863+ $matches = array();
862864 if( !$this->summary && !$this->preview && !$this->diff ) {
863865 preg_match( "/^(=+)(.+)\\1/mi",
864866 $this->textbox1,
@@ -1513,6 +1515,7 @@
15141516 }
15151517 $currentText = $currentRevision->getText();
15161518
 1519+ $result = '';
15171520 if( wfMerge( $baseText, $editText, $currentText, $result ) ){
15181521 $editText = $result;
15191522 wfProfileOut( $fname );
Index: trunk/phase3/includes/Profiler.php
@@ -164,7 +164,7 @@
165165 }
166166
167167 function getCallTreeLine($entry) {
168 - list ($fname, $level, $start, $x, $end) = $entry;
 168+ list ($fname, $level, $start, /* $x */, $end) = $entry;
169169 $delta = $end - $start;
170170 $space = str_repeat(' ', $level);
171171
@@ -208,7 +208,6 @@
209209 # First, subtract the overhead!
210210 foreach ($this->mStack as $entry) {
211211 $fname = $entry[0];
212 - $thislevel = $entry[1];
213212 $start = $entry[2];
214213 $end = $entry[4];
215214 $elapsed = $end - $start;
@@ -229,7 +228,6 @@
230229 # Collate
231230 foreach ($this->mStack as $index => $entry) {
232231 $fname = $entry[0];
233 - $thislevel = $entry[1];
234232 $start = $entry[2];
235233 $end = $entry[4];
236234 $elapsed = $end - $start;
Index: trunk/phase3/includes/HTMLForm.php
@@ -99,7 +99,7 @@
100100 if ( $this->mRequest->wasPosted() ) {
101101 $arr = $this->mRequest->getArray( $varname );
102102 if ( is_array( $arr ) ) {
103 - foreach ( $_POST[$varname] as $index => $element ) {
 103+ foreach ( $_POST[$varname] as $element ) {
104104 $s .= htmlspecialchars( $element )."\n";
105105 }
106106 }
Index: trunk/phase3/includes/SpecialUserrights.php
@@ -89,7 +89,6 @@
9090
9191 $oldGroups = $u->getGroups();
9292 $newGroups = $oldGroups;
93 - $logcomment = ' ';
9493 // remove then add groups
9594 if(isset($removegroup)) {
9695 $newGroups = array_diff($newGroups, $removegroup);
Index: trunk/phase3/includes/SpecialWatchlist.php
@@ -150,21 +150,17 @@
151151 wfAppendToArrayIfNotDefault( 'namespace', $nameSpace, $defaults, $nondefaults );
152152
153153 if ( $days <= 0 ) {
154 - $docutoff = '';
155154 $cutoff = false;
156155 $npages = wfMsg( 'watchlistall1' );
157156 } else {
158 - $docutoff = "AND rev_timestamp > '" .
159 - ( $cutoff = $dbr->timestamp( time() - intval( $days * 86400 ) ) )
160 - . "'";
161 - /*
162 - $sql = "SELECT COUNT(*) AS n FROM $page, $revision WHERE rev_timestamp>'$cutoff' AND page_id=rev_page";
163 - $res = $dbr->query( $sql, $fname );
164 - $s = $dbr->fetchObject( $res );
165 - $npages = $s->n;
166 - */
167 - $npages = 40000 * $days;
168 -
 157+ $cutoff = $dbr->timestamp( time() - intval( $days * 86400 ) );
 158+ /*
 159+ $sql = "SELECT COUNT(*) AS n FROM $page, $revision WHERE rev_timestamp>'$cutoff' AND page_id=rev_page";
 160+ $res = $dbr->query( $sql, $fname );
 161+ $s = $dbr->fetchObject( $res );
 162+ $npages = $s->n;
 163+ */
 164+ $npages = 40000 * $days;
169165 }
170166
171167 /* Edit watchlist form */
@@ -215,7 +211,6 @@
216212 } else {
217213 global $wgContLang;
218214 $toolLinks = array();
219 - $titleText = $titleObj->getPrefixedText();
220215 $pageLink = $sk->makeLinkObj( $titleObj );
221216 $toolLinks[] = $sk->makeLinkObj( $titleObj->getTalkPage(), $wgLang->getNsText( NS_TALK ) );
222217 if( $titleObj->exists() )
@@ -327,7 +322,6 @@
328323 # Spit out some control panel links
329324 $thisTitle = SpecialPage::getTitleFor( 'Watchlist' );
330325 $skin = $wgUser->getSkin();
331 - $linkElements = array( 'hideOwn' => 'wlhideshowown', 'hideBots' => 'wlhideshowbots' );
332326
333327 # Problems encountered using the fancier method
334328 $label = $hideBots ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' );
@@ -428,7 +422,6 @@
429423 function wlCutoffLinks( $days, $page = 'Watchlist', $options = array() ) {
430424 $hours = array( 1, 2, 6, 12 );
431425 $days = array( 1, 3, 7 );
432 - $cl = '';
433426 $i = 0;
434427 foreach( $hours as $h ) {
435428 $hours[$i++] = wlHoursLink( $h, $page, $options );
Index: trunk/phase3/includes/SpecialNewimages.php
@@ -9,7 +9,7 @@
1010 *
1111 */
1212 function wfSpecialNewimages( $par, $specialPage ) {
13 - global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgGroupPermissions;
 13+ global $wgUser, $wgOut, $wgLang, $wgRequest, $wgGroupPermissions;
1414
1515 $wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
1616 $dbr =& wfGetDB( DB_SLAVE );
@@ -67,9 +67,11 @@
6868 /** Hardcode this for now. */
6969 $limit = 48;
7070
71 - if ( $parval = intval( $par ) )
72 - if ( $parval <= $limit && $parval > 0 )
 71+ if ( $parval = intval( $par ) ) {
 72+ if ( $parval <= $limit && $parval > 0 ) {
7373 $limit = $parval;
 74+ }
 75+ }
7476
7577 $where = array();
7678 $searchpar = '';
@@ -163,7 +165,6 @@
164166 htmlspecialchars( $wpIlMatch ) . "\" /> " .
165167 "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" );
166168 }
167 - $here = $wgContLang->specialPage( 'Newimages' );
168169
169170 /**
170171 * Paging controls...
Index: trunk/phase3/includes/Linker.php
@@ -38,7 +38,6 @@
3939 function getInterwikiLinkAttributes( $link, $text, $class='' ) {
4040 global $wgContLang;
4141
42 - $same = ($link == $text);
4342 $link = urldecode( $link );
4443 $link = $wgContLang->checkTitleEncoding( $link );
4544 $link = preg_replace( '/[\\x00-\\x1f]/', ' ', $link );
@@ -200,8 +199,6 @@
201200 return "<!-- ERROR -->{$prefix}{$text}{$trail}";
202201 }
203202
204 - $ns = $nt->getNamespace();
205 - $dbkey = $nt->getDBkey();
206203 if ( $nt->isExternal() ) {
207204 $u = $nt->getFullURL();
208205 $link = $nt->getPrefixedURL();
@@ -210,6 +207,7 @@
211208
212209 $inside = '';
213210 if ( '' != $trail ) {
 211+ $m = array();
214212 if ( preg_match( '/^([a-z]+)(.*)$$/sD', $trail, $m ) ) {
215213 $inside = $m[1];
216214 $trail = $m[2];
@@ -381,8 +379,6 @@
382380 * the end of the link.
383381 */
384382 function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
385 - $link = $nt->getPrefixedURL();
386 -
387383 $u = $nt->escapeLocalURL( $query );
388384
389385 if ( '' == $text ) {
@@ -717,7 +713,6 @@
718714 ### HOTFIX. Instead of breaking, return empty string.
719715 return $text;
720716 } else {
721 - $name = $title->getDBKey();
722717 $img = new Image( $title );
723718 if( $img->exists() ) {
724719 $url = $img->getURL();
@@ -901,6 +896,7 @@
902897 # some nasty regex.
903898 # We look for all comments, match any text before and after the comment,
904899 # add a separator where needed and format the comment itself with CSS
 900+ $match = array();
905901 while (preg_match('/(.*)\/\*\s*(.*?)\s*\*\/(.*)/', $comment,$match)) {
906902 $pre=$match[1];
907903 $auto=$match[2];
@@ -943,6 +939,7 @@
944940 } else {
945941 $text = $match[1];
946942 }
 943+ $submatch = array();
947944 if( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) {
948945 # Media link; trail not supported.
949946 $linkRegexp = '/\[\[(.*?)\]\]/';
@@ -1094,6 +1091,7 @@
10951092 }
10961093 $inside = '';
10971094 if ( '' != $trail ) {
 1095+ $m = array();
10981096 if ( preg_match( $regex, $trail, $m ) ) {
10991097 $inside = $m[1];
11001098 $trail = $m[2];
Index: trunk/phase3/includes/MimeMagic.php
@@ -403,8 +403,6 @@
404404 elseif ($tag==="svg") $mime= "image/svg";
405405 elseif (strpos($doctype,"-//W3C//DTD XHTML")===0) $mime= "text/html";
406406 elseif ($tag==="html") $mime= "text/html";
407 -
408 - $test_more= false;
409407 }
410408 }
411409
Index: trunk/phase3/includes/Parser.php
@@ -383,10 +383,9 @@
384384 */
385385 function recursiveTagParse( $text ) {
386386 wfProfileIn( __METHOD__ );
387 - $x =& $this->mStripState;
388 - wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$x ) );
389 - $text = $this->strip( $text, $x );
390 - wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$x ) );
 387+ wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) );
 388+ $text = $this->strip( $text, $this->mStripState );
 389+ wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) );
391390 $text = $this->internalParse( $text );
392391 wfProfileOut( __METHOD__ );
393392 return $text;
@@ -931,8 +930,7 @@
932931 wfProfileIn( $fname );
933932
934933 # Hook to suspend the parser in this state
935 - $x =& $this->mStripState; // FIXME: Please check that this initialization is correct.
936 - if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$x ) ) ) {
 934+ if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$this->mStripState ) ) ) {
937935 wfProfileOut( $fname );
938936 return $text ;
939937 }
@@ -1820,7 +1818,7 @@
18211819 * @return string less-or-more HTML with NOPARSE bits
18221820 */
18231821 function armorLinks( $text ) {
1824 - return preg_replace( "/\b(" . wfUrlProtocols() . ')/',
 1822+ return preg_replace( '/\b(' . wfUrlProtocols() . ')/',
18251823 "{$this->mUniqPrefix}NOPARSE$1", $text );
18261824 }
18271825
Index: trunk/phase3/includes/LinkBatch.php
@@ -97,7 +97,7 @@
9898
9999 // The remaining links in $data are bad links, register them as such
100100 foreach ( $remaining as $ns => $dbkeys ) {
101 - foreach ( $dbkeys as $dbkey => $nothing ) {
 101+ foreach ( array_keys($dbkeys) as $dbkey ) {
102102 $title = Title::makeTitle( $ns, $dbkey );
103103 $cache->addBadLinkObj( $title );
104104 $ids[$title->getPrefixedDBkey()] = 0;
@@ -112,7 +112,6 @@
113113 */
114114 function doQuery() {
115115 $fname = 'LinkBatch::doQuery';
116 - $namespaces = array();
117116
118117 if ( $this->isEmpty() ) {
119118 return false;
@@ -161,7 +160,7 @@
162161 $sql .= "({$prefix}_namespace=$ns AND {$prefix}_title IN (";
163162
164163 $firstTitle = true;
165 - foreach( $dbkeys as $dbkey => $nothing ) {
 164+ foreach( array_keys($dbkeys) as $dbkey ) {
166165 if ( $firstTitle ) {
167166 $firstTitle = false;
168167 } else {
Index: trunk/phase3/includes/User.php
@@ -344,7 +344,7 @@
345345 * @return bool
346346 */
347347 static function isIP( $name ) {
348 - return preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/",$name);
 348+ return preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/',$name);
349349 /*return preg_match("/^
350350 (?:[01]?\d{1,2}|2(:?[0-4]\d|5[0-5]))\.
351351 (?:[01]?\d{1,2}|2(:?[0-4]\d|5[0-5]))\.
@@ -873,6 +873,7 @@
874874 $found = false;
875875 $host = '';
876876
 877+ $m = array();
877878 if ( preg_match( '/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/', $ip, $m ) ) {
878879 # Make hostname
879880 for ( $i=4; $i>=1; $i-- ) {
@@ -939,6 +940,7 @@
940941 if( isset( $limits['ip'] ) ) {
941942 $keys["mediawiki:limiter:$action:ip:$ip"] = $limits['ip'];
942943 }
 944+ $matches = array();
943945 if( isset( $limits['subnet'] ) && preg_match( '/^(\d+\.\d+\.\d+)\.\d+$/', $ip, $matches ) ) {
944946 $subnet = $matches[1];
945947 $keys["mediawiki:limiter:$action:subnet:$subnet"] = $limits['subnet'];
@@ -1585,7 +1587,7 @@
15861588 * @todo FIXME : need to check the old failback system [AV]
15871589 */
15881590 function &getSkin() {
1589 - global $IP, $wgRequest;
 1591+ global $wgRequest;
15901592 if ( ! isset( $this->mSkin ) ) {
15911593 wfProfileIn( __METHOD__ );
15921594
@@ -1672,7 +1674,7 @@
16731675 // any matching rows
16741676 if ( $watched ) {
16751677 $dbw =& wfGetDB( DB_MASTER );
1676 - $success = $dbw->update( 'watchlist',
 1678+ $dbw->update( 'watchlist',
16771679 array( /* SET */
16781680 'wl_notificationtimestamp' => NULL
16791681 ), array( /* WHERE */
@@ -1703,7 +1705,7 @@
17041706 if( $currentUser != 0 ) {
17051707
17061708 $dbw =& wfGetDB( DB_MASTER );
1707 - $success = $dbw->update( 'watchlist',
 1709+ $dbw->update( 'watchlist',
17081710 array( /* SET */
17091711 'wl_notificationtimestamp' => NULL
17101712 ), array( /* WHERE */
@@ -1740,6 +1742,7 @@
17411743 $this->mOptions = array();
17421744 $a = explode( "\n", $str );
17431745 foreach ( $a as $s ) {
 1746+ $m = array();
17441747 if ( preg_match( "/^(.[^=]*)=(.*)$/", $s, $m ) ) {
17451748 $this->mOptions[$m[1]] = $m[2];
17461749 }
@@ -1819,7 +1822,6 @@
18201823 * Checks if a user with the given name exists, returns the ID
18211824 */
18221825 function idForName() {
1823 - $gotid = 0;
18241826 $s = trim( $this->getName() );
18251827 if ( 0 == strcmp( '', $s ) ) return 0;
18261828
Index: trunk/phase3/includes/ImagePage.php
@@ -142,6 +142,7 @@
143143 $fields = array();
144144 $lines = explode( "\n", wfMsgForContent( 'metadata-fields' ) );
145145 foreach( $lines as $line ) {
 146+ $matches = array();
146147 if( preg_match( '/^\\*\s*(.*?)\s*$/', $line, $matches ) ) {
147148 $fields[] = $matches[1];
148149 }
@@ -536,15 +537,10 @@
537538 * @param $reason User provided reason for deletion.
538539 */
539540 function doDelete( $reason ) {
540 - global $wgOut, $wgRequest, $wgUseSquid;
541 - global $wgPostCommitUpdateList;
 541+ global $wgOut, $wgRequest;
542542
543 - $fname = 'ImagePage::doDelete';
544 -
545543 $oldimage = $wgRequest->getVal( 'oldimage' );
546544
547 - $dbw =& wfGetDB( DB_MASTER );
548 -
549545 if ( !is_null( $oldimage ) ) {
550546 if ( strlen( $oldimage ) < 16 ) {
551547 $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) );
Index: trunk/phase3/includes/SpecialBlockip.php
@@ -80,7 +80,6 @@
8181 }
8282
8383 $scBlockAddress = htmlspecialchars( $this->BlockAddress );
84 - $scBlockExpiry = htmlspecialchars( $this->BlockExpiry );
8584 $scBlockReason = htmlspecialchars( $this->BlockReason );
8685 $scBlockOtherTime = htmlspecialchars( $this->BlockOther );
8786 $scBlockExpiryOptions = htmlspecialchars( wfMsgForContent( 'ipboptions' ) );
@@ -189,6 +188,7 @@
190189
191190 # Check for invalid specifications
192191 if ( ! preg_match( "/^$rxIP$/", $this->BlockAddress ) ) {
 192+ $matches = array();
193193 if ( preg_match( "/^($rxIP)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) {
194194 if ( $wgSysopRangeBans ) {
195195 if ( $matches[2] > 31 || $matches[2] < 16 ) {
Index: trunk/phase3/includes/RecentChange.php
@@ -95,7 +95,7 @@
9696 # Writes the data in this object to the database
9797 function save()
9898 {
99 - global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix, $wgUseRCPatrol;
 99+ global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix;
100100 $fname = 'RecentChange::save';
101101
102102 $dbw =& wfGetDB( DB_MASTER );
Index: trunk/phase3/includes/SpecialAllpages.php
@@ -83,8 +83,7 @@
8484 * @param integer $namespace (default NS_MAIN)
8585 */
8686 function showToplevel ( $namespace = NS_MAIN, $including = false ) {
87 - global $wgOut, $wgUser;
88 - $sk = $wgUser->getSkin();
 87+ global $wgOut;
8988 $fname = "indexShowToplevel";
9089
9190 # TODO: Either make this *much* faster or cache the title index points
@@ -186,8 +185,6 @@
187186 */
188187 function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) {
189188 global $wgUser;
190 - $sk = $wgUser->getSkin();
191 - $dbr =& wfGetDB( DB_SLAVE );
192189
193190 $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
194191 $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) );
@@ -241,7 +238,6 @@
242239 $n = 0;
243240 $out = '<table style="background: inherit;" border="0" width="100%">';
244241
245 - $namespaces = $wgContLang->getFormattedNamespaces();
246242 while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) {
247243 $t = Title::makeTitle( $s->page_namespace, $s->page_title );
248244 if( $t ) {
@@ -298,18 +294,20 @@
299295 return array( $ns, '', '' ); # shortcut for common case
300296
301297 $t = Title::makeTitleSafe($ns, $text);
302 - if ( $t && $t->isLocal() )
 298+ if ( $t && $t->isLocal() ) {
303299 return array( $t->getNamespace(), $t->getDBkey(), $t->getText() );
304 - else if ( $t )
 300+ } else if ( $t ) {
305301 return NULL;
 302+ }
306303
307304 # try again, in case the problem was an empty pagename
308305 $text = preg_replace('/(#|$)/', 'X$1', $text);
309306 $t = Title::makeTitleSafe($ns, $text);
310 - if ( $t && $t->isLocal() )
 307+ if ( $t && $t->isLocal() ) {
311308 return array( $t->getNamespace(), '', '' );
312 - else
 309+ } else {
313310 return NULL;
 311+ }
314312 }
315313 }
316314
Index: trunk/phase3/includes/SearchPostgres.php
@@ -60,6 +60,7 @@
6161 $this->searchTerms = array();
6262
6363 # FIXME: This doesn't handle parenthetical expressions.
 64+ $m = array();
6465 if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
6566 $filteredText, $m, PREG_SET_ORDER ) ) {
6667 foreach( $m as $terms ) {
@@ -77,7 +78,7 @@
7879 $this->searchTerms[] = $regexp;
7980 }
8081 wfDebug( "Would search with '$searchon'\n" );
81 - wfDebug( "Match with /\b" . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
 82+ wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
8283 } else {
8384 wfDebug( "Can't understand search query '{$this->filteredText}'\n" );
8485 }
Index: trunk/phase3/includes/normal/RandomTest.php
@@ -68,6 +68,7 @@
6969 $diffs = new Diff( $ota, $nta );
7070 $formatter = new TableDiffFormatter();
7171 $funky = $formatter->format( $diffs );
 72+ $matches = array();
7273 preg_match_all( '/<span class="diffchange">(.*?)<\/span>/', $funky, $matches );
7374 foreach( $matches[1] as $bit ) {
7475 $hex = bin2hex( $bit );
Index: trunk/phase3/includes/normal/UtfNormalGenerate.php
@@ -43,6 +43,7 @@
4444 print "Initializing normalization quick check tables...\n";
4545 $checkNFC = array();
4646 while( false !== ($line = fgets( $in ) ) ) {
 47+ $matches = array();
4748 if( preg_match( '/^([0-9A-F]+)(?:..([0-9A-F]+))?\s*;\s*(NFC_QC)\s*;\s*([MN])/', $line, $matches ) ) {
4849 list( $junk, $first, $last, $prop, $value ) = $matches;
4950 #print "$first $last $prop $value\n";
Index: trunk/phase3/includes/normal/Utf8Test.php
@@ -45,6 +45,7 @@
4646
4747 $columns = 0;
4848 while( false !== ( $line = fgets( $in ) ) ) {
 49+ $matches = array();
4950 if( preg_match( '/^(Here come the tests:\s*)\|$/', $line, $matches ) ) {
5051 $columns = strpos( $line, '|' );
5152 break;
@@ -86,6 +87,7 @@
8788 $success = 0;
8889 $total = 0;
8990 while( false !== ( $line = fgets( $in ) ) ) {
 91+ $matches = array();
9092 if( preg_match( '/^(\d+)\s+(.*?)\s*\|/', $line, $matches ) ) {
9193 $section = $matches[1];
9294 print $line;
Index: trunk/phase3/includes/normal/UtfNormal.php
@@ -224,8 +224,7 @@
225225 * @static
226226 */
227227 static function loadData() {
228 - # fixme : are $utfCanonicalComp, $utfCanonicalDecomp really used?
229 - global $utfCombiningClass, $utfCanonicalComp, $utfCanonicalDecomp;
 228+ global $utfCombiningClass;
230229 if( !isset( $utfCombiningClass ) ) {
231230 require_once( 'UtfNormalData.inc' );
232231 }
@@ -329,6 +328,7 @@
330329 # large ASCII parts can be handled much more quickly.
331330 # Don't chop up Unicode areas for punctuation, though,
332331 # that wastes energy.
 332+ $matches = array();
333333 preg_match_all(
334334 '/([\x00-\x7f]+|[\x80-\xff][\x00-\x40\x5b-\x5f\x7b-\xff]*)/',
335335 $string, $matches );
@@ -551,7 +551,7 @@
552552 * @return string a UTF-8 string decomposed, not yet normalized (needs sorting)
553553 * @static
554554 */
555 - static function fastDecompose( $string, &$map ) {
 555+ static function fastDecompose( $string, $map ) {
556556 UtfNormal::loadData();
557557 $len = strlen( $string );
558558 $out = '';
Index: trunk/phase3/includes/normal/UtfNormalTest.php
@@ -73,6 +73,7 @@
7474 while( false !== ( $line = fgets( $in ) ) ) {
7575 list( $data, $comment ) = explode( '#', $line );
7676 if( $data === '' ) continue;
 77+ $matches = array();
7778 if( preg_match( '/@Part([\d])/', $data, $matches ) ) {
7879 if( $matches[1] > 0 ) {
7980 $ok = reportResults( $total, $success, $failure ) && $ok;
@@ -236,7 +237,6 @@
237238 $result = verbosify( $char, $u->toNFD( $char ), 1, 'NFD', $reportFailure ) && $result;
238239 $result = verbosify( $char, $u->toNFKC( $char ), 1, 'NFKC', $reportFailure ) && $result;
239240 $result = verbosify( $char, $u->toNFKD( $char ), 1, 'NFKD', $reportFailure ) && $result;
240 - $c = $char;
241241 $result = verbosify( $char, $u->cleanUp( $char ), 1, 'cleanUp', $reportFailure ) && $result;
242242 global $verbose;
243243 if( $verbose && !$result && !$reportFailure ) {
Index: trunk/phase3/includes/MessageCache.php
@@ -298,8 +298,6 @@
299299 if ( !$dbr ) {
300300 throw new MWException( 'Invalid database object' );
301301 }
302 - $conditions = array( 'page_is_redirect' => 0,
303 - 'page_namespace' => NS_MEDIAWIKI);
304302 $res = $dbr->select( array( 'page', 'revision', 'text' ),
305303 array( 'page_title', 'old_text', 'old_flags' ),
306304 'page_is_redirect=0 AND page_namespace='.NS_MEDIAWIKI.' AND page_latest=rev_id AND rev_text_id=old_id',
@@ -315,7 +313,7 @@
316314 # Go through the language array and the extension array and make a note of
317315 # any keys missing from the cache
318316 $allMessages = Language::getMessagesFor( 'en' );
319 - foreach ( $allMessages as $key => $value ) {
 317+ foreach ( array_keys($allMessages) as $key ) {
320318 $uckey = $wgLang->ucfirst( $key );
321319 if ( !array_key_exists( $uckey, $this->mCache ) ) {
322320 $this->mCache[$uckey] = false;
@@ -326,7 +324,7 @@
327325 MessageCache::loadAllMessages();
328326
329327 # Add them to the cache
330 - foreach ( $this->mExtensionMessages as $key => $value ) {
 328+ foreach ( array_keys($this->mExtensionMessages) as $key ) {
331329 $uckey = $wgLang->ucfirst( $key );
332330 if ( !array_key_exists( $uckey, $this->mCache ) &&
333331 ( isset( $this->mExtensionMessages[$key][$wgLang->getCode()] ) || isset( $this->mExtensionMessages[$key]['en'] ) ) ) {
@@ -345,7 +343,7 @@
346344 if ( !$this->mKeys ) {
347345 $this->mKeys = array();
348346 $allMessages = Language::getMessagesFor( 'en' );
349 - foreach ( $allMessages as $key => $value ) {
 347+ foreach ( array_keys($allMessages) as $key ) {
350348 $title = $wgContLang->ucfirst( $key );
351349 array_push( $this->mKeys, $title );
352350 }
Index: trunk/phase3/includes/SpecialWhatlinkshere.php
@@ -57,8 +57,6 @@
5858 $wgOut->setPagetitle( $this->target->getPrefixedText() );
5959 $wgOut->setSubtitle( wfMsg( 'linklistsub' ) );
6060
61 - $isredir = ' (' . wfMsg( 'isredirect' ) . ")\n";
62 -
6361 $wgOut->addHTML( wfMsg( 'whatlinkshere-barrow' ) . ' ' .$this->skin->makeLinkObj($this->target, '', 'redirect=no' )."<br />\n");
6462
6563 $this->showIndirectLinks( 0, $this->target, $this->limit, $this->from, $this->dir );
Index: trunk/phase3/includes/SpecialRecentchanges.php
@@ -14,7 +14,7 @@
1515 * Constructor
1616 */
1717 function wfSpecialRecentchanges( $par, $specialPage ) {
18 - global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol, $wgDBtype;
 18+ global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol;
1919 global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
2020 global $wgAllowCategorizedRecentChanges ;
2121 $fname = 'wfSpecialRecentchanges';
@@ -90,7 +90,8 @@
9191 if ( is_numeric( $bit ) ) {
9292 $limit = $bit;
9393 }
94 -
 94+
 95+ $m = array();
9596 if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
9697 $limit = $m[1];
9798 }
@@ -222,7 +223,6 @@
223224 }
224225
225226 // And now for the content
226 - $sk = $wgUser->getSkin();
227227 $wgOut->setSyndicated( true );
228228
229229 $list = ChangesList::newFromUser( $wgUser );
@@ -397,7 +397,6 @@
398398 $sorted[$n] = $obj;
399399 $n++;
400400 }
401 - $first = false;
402401 }
403402
404403 foreach( $sorted as $obj ) {
Index: trunk/phase3/includes/Article.php
@@ -79,7 +79,7 @@
8080 }
8181 } else {
8282 if( $rt->getNamespace() == NS_SPECIAL ) {
83 - // Gotta hand redirects to special pages differently:
 83+ // Gotta handle redirects to special pages differently:
8484 // Fill the HTTP response "Location" header and ignore
8585 // the rest of the page we're on.
8686 //
@@ -139,7 +139,7 @@
140140 * @return Return the text of this revision
141141 */
142142 function getContent() {
143 - global $wgRequest, $wgUser, $wgOut;
 143+ global $wgUser, $wgOut;
144144
145145 wfProfileIn( __METHOD__ );
146146
@@ -236,9 +236,6 @@
237237
238238 # Pre-fill content with error message so that if something
239239 # fails we'll have something telling us what we intended.
240 -
241 - $t = $this->mTitle->getPrefixedText();
242 -
243240 $this->mOldId = $oldid;
244241 $this->fetchContent( $oldid );
245242 }
@@ -575,13 +572,10 @@
576573 function getContributors($limit = 0, $offset = 0) {
577574 # XXX: this is expensive; cache this info somewhere.
578575
579 - $title = $this->mTitle;
580576 $contribs = array();
581577 $dbr =& wfGetDB( DB_SLAVE );
582578 $revTable = $dbr->tableName( 'revision' );
583579 $userTable = $dbr->tableName( 'user' );
584 - $encDBkey = $dbr->addQuotes( $title->getDBkey() );
585 - $ns = $title->getNamespace();
586580 $user = $this->getUser();
587581 $pageId = $this->getId();
588582
@@ -784,9 +778,6 @@
785779 if( !$wasRedirected && $this->isCurrent() ) {
786780 $wgOut->setSubtitle( wfMsgHtml( 'redirectpagesub' ) );
787781 }
788 - $targetUrl = $rt->escapeLocalURL();
789 - # fixme unused $titleText :
790 - $titleText = htmlspecialchars( $rt->getPrefixedText() );
791782 $link = $sk->makeLinkObj( $rt );
792783
793784 $wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT" />' .
@@ -1924,7 +1915,7 @@
19251916 */
19261917 function doDeleteArticle( $reason ) {
19271918 global $wgUseSquid, $wgDeferredUpdateList;
1928 - global $wgPostCommitUpdateList, $wgUseTrackbacks;
 1919+ global $wgUseTrackbacks;
19291920
19301921 wfDebug( __METHOD__."\n" );
19311922
@@ -2041,8 +2032,6 @@
20422033 $bot = $wgRequest->getBool( 'bot' );
20432034
20442035 # Replace all this user's current edits with the next one down
2045 - $tt = $this->mTitle->getDBKey();
2046 - $n = $this->mTitle->getNamespace();
20472036
20482037 # Get the last editor
20492038 $current = Revision::newFromTitle( $this->mTitle );
@@ -2409,8 +2398,7 @@
24102399 'comment' => $comment,
24112400 'minor_edit' => $minor ? 1 : 0,
24122401 ) );
2413 - # fixme : $revisionId never used
2414 - $revisionId = $revision->insertOn( $dbw );
 2402+ $revision->insertOn( $dbw );
24152403 $this->updateRevisionOn( $dbw, $revision );
24162404 $dbw->commit();
24172405
@@ -2524,8 +2512,6 @@
25252513 static function onArticleEdit( $title ) {
25262514 global $wgDeferredUpdateList, $wgUseFileCache;
25272515
2528 - $urls = array();
2529 -
25302516 // Invalidate caches of articles which include this page
25312517 $update = new HTMLCacheUpdate( $title, 'templatelinks' );
25322518 $wgDeferredUpdateList[] = $update;
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -52,6 +52,7 @@
5353 # UTF-8 substr function based on a PHP manual comment
5454 if ( !function_exists( 'mb_substr' ) ) {
5555 function mb_substr( $str, $start ) {
 56+ $ar = array();
5657 preg_match_all( '/./us', $str, $ar );
5758
5859 if( func_num_args() >= 3 ) {
@@ -71,7 +72,7 @@
7273 */
7374 function array_diff_key( $left, $right ) {
7475 $result = $left;
75 - foreach ( $left as $key => $value ) {
 76+ foreach ( array_keys($left) as $key ) {
7677 if ( isset( $right[$key] ) ) {
7778 unset( $result[$key] );
7879 }
@@ -382,8 +383,6 @@
383384 * @return String: the requested message.
384385 */
385386 function wfMsgReal( $key, $args, $useDB = true, $forContent=false, $transform = true ) {
386 - $fname = 'wfMsgReal';
387 -
388387 $message = wfMsgGetKey( $key, $useDB, $forContent, $transform );
389388 $message = wfMsgReplaceArgs( $message, $args );
390389 return $message;
@@ -530,7 +529,7 @@
531530 * <i>parsemag<i>: ??
532531 */
533532 function wfMsgExt( $key, $options ) {
534 - global $wgOut, $wgMsgParserOptions, $wgParser;
 533+ global $wgOut, $wgParser;
535534
536535 $args = func_get_args();
537536 array_shift( $args );
@@ -807,6 +806,7 @@
808807 global $wgUseGzip;
809808 if( $wgUseGzip ) {
810809 # FIXME: we may want to blacklist some broken browsers
 810+ $m = array();
811811 if( preg_match(
812812 '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
813813 $_SERVER['HTTP_ACCEPT_ENCODING'],
@@ -972,6 +972,7 @@
973973 }
974974 // Double the backslashes before the end of the string, because
975975 // we will soon add a quote
 976+ $m = array();
976977 if ( preg_match( '/^(.*?)(\\\\+)$/', $arg, $m ) ) {
977978 $arg = $m[1] . str_replace( '\\', '\\\\', $m[2] );
978979 }
@@ -1095,6 +1096,7 @@
10961097 foreach( $parts as $part ) {
10971098 # FIXME: doesn't deal with params like 'text/html; level=1'
10981099 @list( $value, $qpart ) = explode( ';', $part );
 1100+ $match = array();
10991101 if( !isset( $qpart ) ) {
11001102 $prefs[$value] = 1;
11011103 } elseif( preg_match( '/q\s*=\s*(\d*\.\d+)/', $qpart, $match ) ) {
@@ -1289,19 +1291,19 @@
12901292 $da = array();
12911293 if ($ts==0) {
12921294 $uts=time();
1293 - } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D",$ts,$da)) {
 1295+ } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D',$ts,$da)) {
12941296 # TS_DB
12951297 $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
12961298 (int)$da[2],(int)$da[3],(int)$da[1]);
1297 - } elseif (preg_match("/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/D",$ts,$da)) {
 1299+ } elseif (preg_match('/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/D',$ts,$da)) {
12981300 # TS_EXIF
12991301 $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
13001302 (int)$da[2],(int)$da[3],(int)$da[1]);
1301 - } elseif (preg_match("/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/D",$ts,$da)) {
 1303+ } elseif (preg_match('/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/D',$ts,$da)) {
13021304 # TS_MW
13031305 $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
13041306 (int)$da[2],(int)$da[3],(int)$da[1]);
1305 - } elseif (preg_match("/^(\d{1,13})$/D",$ts,$datearray)) {
 1307+ } elseif (preg_match('/^(\d{1,13})$/D',$ts,$da)) {
13061308 # TS_UNIX
13071309 $uts = $ts;
13081310 } elseif (preg_match('/^(\d{1,2})-(...)-(\d\d(\d\d)?) (\d\d)\.(\d\d)\.(\d\d)/', $ts, $da)) {
@@ -1312,11 +1314,11 @@
13131315 # TS_ISO_8601
13141316 $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
13151317 (int)$da[2],(int)$da[3],(int)$da[1]);
1316 - } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)[\+\- ](\d\d)$/",$ts,$da)) {
 1318+ } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)[\+\- ](\d\d)$/',$ts,$da)) {
13171319 # TS_POSTGRES
13181320 $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
13191321 (int)$da[2],(int)$da[3],(int)$da[1]);
1320 - } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/",$ts,$da)) {
 1322+ } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/',$ts,$da)) {
13211323 # TS_POSTGRES
13221324 $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
13231325 (int)$da[2],(int)$da[3],(int)$da[1]);
@@ -1687,7 +1689,7 @@
16881690
16891691 $output = array();
16901692 $retval = 1; // error by default?
1691 - $lastline = exec( $cmd, $output, $retval );
 1693+ exec( $cmd, $output, $retval ); // returns the last line of output.
16921694 return implode( "\n", $output );
16931695
16941696 }
@@ -1753,6 +1755,7 @@
17541756 * @return string
17551757 */
17561758 function wfBaseName( $path ) {
 1759+ $matches = array();
17571760 if( preg_match( '#([^/\\\\]*)[/\\\\]*$#', $path, $matches ) ) {
17581761 return $matches[1];
17591762 } else {
Index: trunk/phase3/includes/SearchEngine.php
@@ -126,6 +126,7 @@
127127 }
128128
129129 # Quoted term? Try without the quotes...
 130+ $matches = array();
130131 if( preg_match( '/^"([^"]+)"$/', $searchterm, $matches ) ) {
131132 return SearchEngine::getNearMatch( $matches[1] );
132133 }
Index: trunk/phase3/includes/Exif.php
@@ -439,7 +439,7 @@
440440 return false;
441441 }
442442
443 - if ( preg_match( "/^\s*$/", $in ) ) {
 443+ if ( preg_match( '/^\s*$/', $in ) ) {
444444 $this->debug( $in, __FUNCTION__, 'input consisted solely of whitespace' );
445445 return false;
446446 }
@@ -468,7 +468,8 @@
469469 }
470470
471471 function isRational( $in ) {
472 - if ( !is_array( $in ) && @preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero
 472+ $m = array();
 473+ if ( !is_array( $in ) && @preg_match( '/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero
473474 return $this->isLong( $m[1] ) && $this->isLong( $m[2] );
474475 } else {
475476 $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' );
@@ -477,7 +478,7 @@
478479 }
479480
480481 function isUndefined( $in ) {
481 - if ( !is_array( $in ) && preg_match( "/^\d{4}$/", $in ) ) { // Allow ExifVersion and FlashpixVersion
 482+ if ( !is_array( $in ) && preg_match( '/^\d{4}$/', $in ) ) { // Allow ExifVersion and FlashpixVersion
482483 $this->debug( $in, __FUNCTION__, true );
483484 return true;
484485 } else {
@@ -497,7 +498,8 @@
498499 }
499500
500501 function isSrational( $in ) {
501 - if ( !is_array( $in ) && preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero
 502+ $m = array();
 503+ if ( !is_array( $in ) && preg_match( '/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero
502504 return $this->isSlong( $m[0] ) && $this->isSlong( $m[1] );
503505 } else {
504506 $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' );
@@ -729,7 +731,7 @@
730732 case 'DateTime':
731733 case 'DateTimeOriginal':
732734 case 'DateTimeDigitized':
733 - if( preg_match( "/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/", $val ) ) {
 735+ if( preg_match( '/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/', $val ) ) {
734736 $tags[$tag] = $wgLang->timeanddate( wfTimestamp(TS_MW, $val) );
735737 }
736738 break;
@@ -1054,6 +1056,7 @@
10551057 * @return mixed A floating point number or whatever we were fed
10561058 */
10571059 function formatNum( $num ) {
 1060+ $m = array();
10581061 if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) )
10591062 return $m[2] != 0 ? $m[1] / $m[2] : $num;
10601063 else
@@ -1069,6 +1072,7 @@
10701073 * @return mixed A floating point number or whatever we were fed
10711074 */
10721075 function formatFraction( $num ) {
 1076+ $m = array();
10731077 if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) ) {
10741078 $numerator = intval( $m[1] );
10751079 $denominator = intval( $m[2] );
Index: trunk/phase3/includes/DatabaseFunctions.php
@@ -14,7 +14,6 @@
1515 * @param $fname String: name of the php function calling
1616 */
1717 function wfQuery( $sql, $db, $fname = '' ) {
18 - global $wgOut;
1918 if ( !is_numeric( $db ) ) {
2019 # Someone has tried to call this the old way
2120 throw new FatalError( wfMsgNoDB( 'wrong_wfQuery_params', $db, $sql ) );
Index: trunk/phase3/includes/SpecialRecentchangeslinked.php
@@ -48,7 +48,7 @@
4949 if ( ! $days ) { $days = 7; }
5050 }
5151 $days = (int)$days;
52 - list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
 52+ list( $limit, /* offset */ ) = wfCheckLimits( 100, 'rclimit' );
5353
5454 $dbr =& wfGetDB( DB_SLAVE );
5555 $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
Index: trunk/phase3/includes/SpecialContributions.php
@@ -168,7 +168,6 @@
169169 */
170170 function wfSpecialContributions( $par = null ) {
171171 global $wgUser, $wgOut, $wgLang, $wgRequest;
172 - $fname = 'wfSpecialContributions';
173172
174173 $target = isset( $par ) ? $par : $wgRequest->getVal( 'target' );
175174 if ( !strlen( $target ) ) {
Index: trunk/phase3/includes/SpecialSearch.php
@@ -70,7 +70,7 @@
7171 }
7272
7373 /**
74 - * If an exact title match can be found, jump straight ahead to
 74+ * If an exact title match can be found, jump straight ahead to it.
7575 * @param string $term
7676 * @public
7777 */
@@ -82,7 +82,6 @@
8383 $this->setupPage( $term );
8484
8585 # Try to go to page as entered.
86 - #
8786 $t = Title::newFromText( $term );
8887
8988 # If the string cannot be used to create a title
Index: trunk/phase3/includes/Sanitizer.php
@@ -391,8 +391,9 @@
392392 $tagstack = $tablestack = array();
393393 foreach ( $bits as $x ) {
394394 $prev = error_reporting( E_ALL & ~( E_NOTICE | E_WARNING ) );
 395+ $regs = array();
395396 preg_match( '!^(/?)(\\w+)([^>]*?)(/{0,1}>)([^<]*)$!', $x, $regs );
396 - list( $qbar, $slash, $t, $params, $brace, $rest ) = $regs;
 397+ list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
397398 error_reporting( $prev );
398399
399400 $badtag = 0 ;
@@ -487,7 +488,7 @@
488489 foreach ( $bits as $x ) {
489490 preg_match( '/^(\\/?)(\\w+)([^>]*?)(\\/{0,1}>)([^<]*)$/',
490491 $x, $regs );
491 - @list( $qbar, $slash, $t, $params, $brace, $rest ) = $regs;
 492+ @list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
492493 if ( isset( $htmlelements[$t = strtolower( $t )] ) ) {
493494 if( is_callable( $processCallback ) ) {
494495 call_user_func_array( $processCallback, array( &$params, $args ) );
@@ -1223,8 +1224,9 @@
12241225 $url = preg_replace( '/[\][<>"\\x00-\\x20\\x7F]/e', "urlencode('\\0')", $url );
12251226
12261227 # Validate hostname portion
 1228+ $matches = array();
12271229 if( preg_match( '!^([^:]+:)(//[^/]+)?(.*)$!iD', $url, $matches ) ) {
1228 - list( $whole, $protocol, $host, $rest ) = $matches;
 1230+ list( /* $whole */, $protocol, $host, $rest ) = $matches;
12291231
12301232 // Characters that will be ignored in IDNs.
12311233 // http://tools.ietf.org/html/3454#section-3.1
Index: trunk/phase3/includes/cbt/CBTCompiler.php
@@ -75,7 +75,6 @@
7676 * Returns true on success, error message on failure
7777 */
7878 function compile() {
79 - $fname = 'CBTProcessor::compile';
8079 $this->mLastError = false;
8180 $this->mOps = array();
8281
@@ -222,7 +221,6 @@
223222 if ( $char == '{' ) {
224223 // Switch to text mode
225224 ++$p;
226 - $tokenStart = $p;
227225 $this->doOpenText( $p, $end );
228226 ++$argCount;
229227 } elseif ( $char == '}' ) {
@@ -292,7 +290,7 @@
293291 wfProfileIn( $fname );
294292 $stack = array();
295293
296 - foreach( $this->mOps as $index => $op ) {
 294+ foreach( $this->mOps as $op ) {
297295 switch( $op->opcode ) {
298296 case CBT_PUSH:
299297 $stack[] = $this->phpQuote( $op->arg1 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r17929Fixed inefficient use of array_keys() introduced by Nick in r17880. If this i...tstarling17:11, 25 November 2006
r20570Reverting SpecialRevisiondelete.php back to r17880, to fix bug 9336 ( "Specia...nickj07:41, 21 March 2007

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r17820* Introduced StringUtils.php, populated it with some generic string functions...tstarling09:53, 21 November 2006