r84739 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84738‎ | r84739 | r84740 >
Date:11:07, 25 March 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Changes default value so that it's not converted to array( 0 => '' ) by the (array) cast a few lines below.

This was breaking the check whether the magic word was found by Language::getMagic() or not.
Modified paths:
  • /trunk/phase3/includes/MagicWord.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/MagicWord.php
@@ -178,7 +178,7 @@
179179
180180 /**#@-*/
181181
182 - function __construct($id = 0, $syn = '', $cs = false) {
 182+ function __construct($id = 0, $syn = array(), $cs = false) {
183183 $this->mId = $id;
184184 $this->mSynonyms = (array)$syn;
185185 $this->mCaseSensitive = $cs;

Sign-offs

UserFlagDate
Hasharinspected20:27, 7 June 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r897411.17: MFT r84739, r89707catrope20:19, 8 June 2011

Comments

#Comment by Hashar (talk | contribs)   20:27, 7 June 2011

Tagging 1.17 which have the same issue.

I am not sure what it breaks though. Ialex, can you possibly write a test case or give a rough example so that someone else write it? :)

#Comment by IAlex (talk | contribs)   20:38, 7 June 2011

The check that was broken is the !$this->mSynonyms at the line 279 of MagicWord.php in the actual code. When the magic word does not exist, the call to $wgContLang->getMagic( $this ); the line above will not alter mSynonyms and casting array( 0 => '' ) to boolean returns true.

Status & tagging log