From: Happy-melon Date: Tue, 24 May 2011 19:03:41 +0000 (+0000) Subject: (bug 29116) follow-up r84475: normalise the empty string to null in Block::newFromTar... X-Git-Tag: 1.31.0-rc.0~29969 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=28105675daaad3b2a6a1aff6083d382f5bfe7b47;p=lhc%2Fweb%2Fwiklou.git (bug 29116) follow-up r84475: normalise the empty string to null in Block::newFromTarget(). --- diff --git a/includes/Block.php b/includes/Block.php index df0dfd694c..d1e498a3dc 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -969,6 +969,12 @@ class Block { * not be the same as the target you gave if you used $vagueTarget! */ public static function newFromTarget( $specificTarget, $vagueTarget = null, $fromMaster = false ) { + # (bug 29116) passing $vagueTarget = '' is not unreasonable here, but int(0) + # is a valid username, so we can't just use weak comparisons. + if( $vagueTarget === '' ){ + $vagueTarget = null; + } + list( $target, $type ) = self::parseTarget( $specificTarget ); if( $type == Block::TYPE_ID || $type == Block::TYPE_AUTO ){ return Block::newFromID( $target );