r67215 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67214‎ | r67215 | r67216 >
Date:09:10, 2 June 2010
Author:daniel
Status:deferred (Comments)
Tags:
Comment:
PHP compatibility: 5.3.1 is picky about pass-by-reference. Restrict use of &$foo to actual output parameters. This should probably be done for the entire code base.
Modified paths:
  • /trunk/extensions/CategoryTree/CategoryTree.php (modified) (history)
  • /trunk/extensions/CategoryTree/CategoryTreeFunctions.php (modified) (history)
  • /trunk/extensions/DataTransclusion/DataTransclusion.php (modified) (history)
  • /trunk/extensions/DataTransclusion/DataTransclusionHandler.php (modified) (history)
  • /trunk/extensions/Gadgets/Gadgets.php (modified) (history)
  • /trunk/extensions/HTMLets/HTMLets.php (modified) (history)
  • /trunk/extensions/News/News.php (modified) (history)
  • /trunk/extensions/News/NewsRenderer.php (modified) (history)
  • /trunk/extensions/PageBy/PageBy.php (modified) (history)
  • /trunk/extensions/PageBy/PageByRenderer.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageBy/PageByRenderer.php
@@ -27,7 +27,7 @@
2828 var $showfirst;
2929 var $showcomments;
3030
31 - function __construct( $page, $argv, &$parser ) {
 31+ function __construct( $page, $argv, $parser ) {
3232 global $wgTitle;
3333
3434 $this->parser = $parser;
Index: trunk/extensions/PageBy/PageBy.php
@@ -33,7 +33,7 @@
3434 $wgParser->setHook( "pageby", "newsxRenderPageBy" );
3535 }
3636
37 -function newsxRenderPageBy( $page, $argv, &$parser ) {
 37+function newsxRenderPageBy( $page, $argv, $parser ) {
3838 $renderer = new PageByRenderer($page, $argv, $parser);
3939 return $renderer->renderPageBy();
4040 }
Index: trunk/extensions/News/News.php
@@ -46,7 +46,7 @@
4747 wfLoadExtensionMessages( 'NewsExtension' );
4848 }
4949
50 -function wfNewsTag( $templatetext, $argv, &$parser ) {
 50+function wfNewsTag( $templatetext, $argv, $parser ) {
5151 global $wgTitle;
5252
5353 $parser->disableCache(); //TODO: use smart cache & purge...?
@@ -55,7 +55,7 @@
5656 return $renderer->renderNews();
5757 }
5858
59 -function wfNewsFeedTag( $templatetext, $argv, &$parser ) {
 59+function wfNewsFeedTag( $templatetext, $argv, $parser ) {
6060 global $wgTitle, $wgOut;
6161
6262 $parser->disableCache(); //TODO: use smart cache & purge...?
@@ -76,7 +76,7 @@
7777 return NewsRenderer::renderFeedLink($linktext, $argv, $parser);
7878 }
7979
80 -function wfNewsArticleFromTitle( &$title, &$article ) {
 80+function wfNewsArticleFromTitle( $title, &$article ) {
8181 global $wgRequest, $wgFeedClasses, $wgUser, $wgOut;
8282 $fname = 'extension/News: wfNewsArticleFromTitle';
8383
@@ -109,7 +109,7 @@
110110 return false;
111111 }
112112
113 -function wfNewsSkinTemplateOutputPageBeforeExec( &$skin, &$tpl ) {
 113+function wfNewsSkinTemplateOutputPageBeforeExec( $skin, $tpl ) {
114114 $feeds = $tpl->data['feeds'];
115115 if (!$feeds) return true;
116116
Index: trunk/extensions/News/NewsRenderer.php
@@ -54,7 +54,7 @@
5555 var $pubtrigger; //word to use in summaries to trigger publication
5656 var $permalinks; //wether to force permalinks in feeds, even in publication mode
5757
58 - static function newFromArticle( &$article, &$parser ) {
 58+ static function newFromArticle( $article, $parser ) {
5959 $title = $article->getTitle();
6060 $article->getContent();
6161 $text = $article->mContent;
@@ -78,7 +78,7 @@
7979 return null;
8080 }
8181
82 - function __construct( $title, $templatetext, $argv, &$parser ) {
 82+ function __construct( $title, $templatetext, $argv, $parser ) {
8383 global $wgContLang, $wgUser;
8484
8585 $this->title = $title;
@@ -611,7 +611,7 @@
612612 return $url;
613613 }
614614
615 - static function renderFeedLink( $text, $argv, &$parser ) {
 615+ static function renderFeedLink( $text, $argv, $parser ) {
616616 $t = @$argv['feed'];
617617 if ($t) $t = NewsRenderer::replaceVariables( $parser, $t );
618618
Index: trunk/extensions/DataTransclusion/DataTransclusionHandler.php
@@ -40,7 +40,7 @@
4141 * Entry point for the {{#record}} parser function.
4242 * This is a wrapper around handleRecordTag
4343 */
44 - static function handleRecordFunction ( &$parser ) {
 44+ static function handleRecordFunction ( $parser ) {
4545 $params = func_get_args();
4646 array_shift( $params ); // first is &$parser, strip it
4747
@@ -132,7 +132,7 @@
133133 }
134134 }
135135
136 - static function renderTemplate( &$parser, $title, $record ) {
 136+ static function renderTemplate( $parser, $title, $record ) {
137137 $p = new Article( $title );
138138 if ( !$p->exists() ) return false;
139139
Index: trunk/extensions/DataTransclusion/DataTransclusion.php
@@ -36,7 +36,7 @@
3737
3838 $wgDataTransclusionSources = array();
3939
40 -function efDataTransclusionSetHooks( &$parser ) {
 40+function efDataTransclusionSetHooks( $parser ) {
4141 $parser->setHook( 'record' , 'DataTransclusionHandler::handleRecordTag' );
4242 $parser->setFunctionHook( 'record' , 'DataTransclusionHandler::handleRecordFunction' ); #FIXME: this doesn't work.
4343 return true;
Index: trunk/extensions/Gadgets/Gadgets.php
@@ -36,7 +36,7 @@
3737 $wgSpecialPages['Gadgets'] = 'SpecialGadgets';
3838 $wgSpecialPageGroups['Gadgets'] = 'wiki';
3939
40 -function wfGadgetsArticleSaveComplete( &$article, &$user, $text ) {
 40+function wfGadgetsArticleSaveComplete( $article, $user, $text ) {
4141 //update cache if MediaWiki:Gadgets-definition was edited
4242 $title = $article->mTitle;
4343 if( $title->getNamespace() == NS_MEDIAWIKI && $title->getText() == 'Gadgets-definition' ) {
@@ -157,7 +157,7 @@
158158 return true;
159159 }
160160
161 -function wfGadgetsBeforePageDisplay( &$out ) {
 161+function wfGadgetsBeforePageDisplay( $out ) {
162162 global $wgUser;
163163 if ( !$wgUser->isLoggedIn() ) return true;
164164
@@ -188,7 +188,7 @@
189189 return true;
190190 }
191191
192 -function wfApplyGadgetCode( $code, &$out, &$done ) {
 192+function wfApplyGadgetCode( $code, $out, &$done ) {
193193 global $wgJsMimeType;
194194
195195 //FIXME: stuff added via $out->addScript appears below usercss and userjs in the head tag.
Index: trunk/extensions/CategoryTree/CategoryTree.php
@@ -198,7 +198,7 @@
199199 }
200200 }
201201
202 -function efCategoryTreeSetHooks( &$parser ) {
 202+function efCategoryTreeSetHooks( $parser ) {
203203 $parser->setHook( 'categorytree' , 'efCategoryTreeParserHook' );
204204 $parser->setFunctionHook( 'categorytree' , 'efCategoryTreeParserFunction' );
205205 return true;
@@ -262,9 +262,9 @@
263263 * Entry point for the {{#categorytree}} tag parser function.
264264 * This is a wrapper around efCategoryTreeParserHook
265265 */
266 -function efCategoryTreeParserFunction( &$parser ) {
 266+function efCategoryTreeParserFunction( $parser ) {
267267 $params = func_get_args();
268 - array_shift( $params ); // first is &$parser, strip it
 268+ array_shift( $params ); // first is $parser, strip it
269269
270270 // first user-supplied parameter must be category name
271271 if ( !$params ) {
@@ -296,7 +296,7 @@
297297 * Hook implementation for injecting a category tree into the sidebar.
298298 * Registered automatically if $wgCategoryTreeSidebarRoot is set to a category name.
299299 */
300 -function efCategoryTreeSkinTemplateOutputPageBeforeExec( &$skin, &$tpl ) {
 300+function efCategoryTreeSkinTemplateOutputPageBeforeExec( $skin, $tpl ) {
301301 global $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions;
302302
303303 $html = efCategoryTreeParserHook( $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions );
@@ -340,7 +340,7 @@
341341 * Hook callback that injects messages and things into the <head> tag
342342 * Does nothing if $parserOutput->mCategoryTreeTag is not set
343343 */
344 -function efCategoryTreeParserOutput( &$outputPage, $parserOutput ) {
 344+function efCategoryTreeParserOutput( $outputPage, $parserOutput ) {
345345 if ( !empty( $parserOutput->mCategoryTreeTag ) ) {
346346 CategoryTree::setHeaders( $outputPage );
347347 }
@@ -350,7 +350,7 @@
351351 /**
352352 * ArticleFromTitle hook, override category page handling
353353 */
354 -function efCategoryTreeArticleFromTitle( &$title, &$article ) {
 354+function efCategoryTreeArticleFromTitle( $title, &$article ) {
355355 if ( $title->getNamespace() == NS_CATEGORY ) {
356356 $article = new CategoryTreeCategoryPage( $title );
357357 }
@@ -360,7 +360,7 @@
361361 /**
362362 * OutputPageMakeCategoryLinks hook, override category links
363363 */
364 -function efCategoryTreeOutputPageMakeCategoryLinks( &$out, &$categories, &$links ) {
 364+function efCategoryTreeOutputPageMakeCategoryLinks( $out, &$categories, &$links ) {
365365 global $wgContLang, $wgCategoryTreePageCategoryOptions;
366366
367367 $ct = new CategoryTree( $wgCategoryTreePageCategoryOptions );
@@ -372,7 +372,7 @@
373373 return false;
374374 }
375375
376 -function efCategoryTreeSkinJoinCategoryLinks( &$skin, &$links, &$result ) {
 376+function efCategoryTreeSkinJoinCategoryLinks( $skin, &$links, &$result ) {
377377 $embed = '<div class="CategoryTreePretendInlineMSIE CategoryTreeCategoryBarItem">';
378378 $pop = '</div>';
379379 $sep = ' ';
Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php
@@ -159,7 +159,7 @@
160160 * Set the script tags in an OutputPage object
161161 * @param OutputPage $outputPage
162162 */
163 - static function setHeaders( &$outputPage ) {
 163+ static function setHeaders( $outputPage ) {
164164 global $wgJsMimeType, $wgScriptPath, $wgContLang;
165165 global $wgCategoryTreeHijackPageCategories, $wgCategoryTreeExtPath, $wgCategoryTreeVersion;
166166
@@ -409,7 +409,7 @@
410410 * Returns a string with an HTML representation of the children of the given category.
411411 * $title must be a Title object
412412 */
413 - function renderChildren( &$title, $depth = 1 ) {
 413+ function renderChildren( $title, $depth = 1 ) {
414414 global $wgCategoryTreeMaxChildren, $wgCategoryTreeUseCategoryTable;
415415
416416 if ( $title->getNamespace() != NS_CATEGORY ) {
@@ -530,7 +530,7 @@
531531 * Returns a string with an HTML representation of the parents of the given category.
532532 * $title must be a Title object
533533 */
534 - function renderParents( &$title ) {
 534+ function renderParents( $title ) {
535535 global $wgCategoryTreeMaxChildren;
536536
537537 $dbr = wfGetDB( DB_SLAVE );
Index: trunk/extensions/HTMLets/HTMLets.php
@@ -59,7 +59,7 @@
6060 }
6161
6262 # The callback function for converting the input text to HTML output
63 -function wfRenderHTMLet( $name, $argv, &$parser ) {
 63+function wfRenderHTMLet( $name, $argv, $parser ) {
6464 global $wgHTMLetsDirectory, $wgHTMLetsHack, $IP;
6565
6666 if (@$argv['nocache']) $parser->disableCache();
@@ -114,7 +114,7 @@
115115 return $output;
116116 }
117117
118 -function wfRenderHTMLetHackPostProcess( &$parser, &$text ) {
 118+function wfRenderHTMLetHackPostProcess( $parser, &$text ) {
119119 $text = preg_replace(
120120 '/<!-- @HTMLetsHACK@ ([0-9a-zA-Z\\+\\/]+=*) @HTMLetsHACK@ -->/esm',
121121 'base64_decode("$1")',

Comments

#Comment by Duesentrieb (talk | contribs)   09:13, 2 June 2010

slight mistake in the commit message: 5.3.0 already complains about this; 5.3.1 is broken anyway (especially wrt pass-by-reference)

Status & tagging log