r88738 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88737‎ | r88738 | r88739 >
Date:19:03, 24 May 2011
Author:happy-melon
Status:resolved (Comments)
Tags:
Comment:
(bug 29116) follow-up r84475: normalise the empty string to null in Block::newFromTarget().
Modified paths:
  • /trunk/phase3/includes/Block.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Block.php
@@ -969,6 +969,12 @@
970970 * not be the same as the target you gave if you used $vagueTarget!
971971 */
972972 public static function newFromTarget( $specificTarget, $vagueTarget = null, $fromMaster = false ) {
 973+ # (bug 29116) passing $vagueTarget = '' is not unreasonable here, but int(0)
 974+ # is a valid username, so we can't just use weak comparisons.
 975+ if( $vagueTarget === '' ){
 976+ $vagueTarget = null;
 977+ }
 978+
973979 list( $target, $type ) = self::parseTarget( $specificTarget );
974980 if( $type == Block::TYPE_ID || $type == Block::TYPE_AUTO ){
975981 return Block::newFromID( $target );

Follow-up revisions

RevisionCommit summaryAuthorDate
r88750* (bug 29116) Fix regression breaking CheckUser extension...brion21:04, 24 May 2011
r90874Follow-up r88738: this check is no longer needed since r88750.happy-melon13:48, 27 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84475Blame hashar for this giant commit; he teased me for making so many smaller o...happy-melon19:12, 21 March 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   21:17, 24 May 2011

int(0) is not a valid username; usernames must be strings. Any situation where a string's been passed to us, we've got "0" not int(0). "0" != .

#Comment by Happy-melon (talk | contribs)   21:47, 24 May 2011

If you're sure about that, then your r88750 is a nicer way of fixing it.

Status & tagging log