r44487 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44486‎ | r44487 | r44488 >
Date:01:05, 12 December 2008
Author:brion
Status:ok
Tags:
Comment:
Clarify the $section parameter a bit on Article::replaceSection() to indicate acceptable input values.
Throw in a strval() around the param on compare so if somebody thinks "hey I'll make it a === because it's 5ns faster" again it won't break anything. :)
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -1265,11 +1265,12 @@
12661266 }
12671267
12681268 /**
 1269+ * @param $section empty/null/false or a section number (0, 1, 2, T1, T2...)
12691270 * @return string Complete article text, or null if error
12701271 */
12711272 public function replaceSection( $section, $text, $summary = '', $edittime = NULL ) {
12721273 wfProfileIn( __METHOD__ );
1273 - if( $section == '' ) {
 1274+ if( strval( $section ) == '' ) {
12741275 // Whole-page edit; let the whole text through
12751276 } else {
12761277 if( is_null($edittime) ) {

Status & tagging log