From: Kunal Mehta Date: Fri, 15 May 2015 19:44:38 +0000 (-0700) Subject: Always pass a valid User object to LoginUserMigrated hook X-Git-Tag: 1.31.0-rc.0~11340^2~1 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=4b504768553c38bb41e6fc0df41d3e7e76b2f4af;p=lhc%2Fweb%2Fwiklou.git Always pass a valid User object to LoginUserMigrated hook Follows up 777078176f0b2. Bug: T96174 Change-Id: I76d33ff5340fbf216c11ff06e2a1b9e01d46ba90 --- diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index c4da642b10..64a6f7244e 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -710,7 +710,11 @@ class LoginForm extends SpecialPage { } $u = User::newFromName( $this->mUsername ); + if ( $u === false ) { + return self::ILLEGAL; + } + $msg = null; // Give extensions a way to indicate the username has been updated, // rather than telling the user the account doesn't exist. if ( !Hooks::run( 'LoginUserMigrated', array( $u, &$msg ) ) ) { @@ -718,7 +722,7 @@ class LoginForm extends SpecialPage { return self::USER_MIGRATED; } - if ( !( $u instanceof User ) || !User::isUsableName( $u->getName() ) ) { + if ( !User::isUsableName( $u->getName() ) ) { return self::ILLEGAL; } @@ -736,7 +740,6 @@ class LoginForm extends SpecialPage { // Give general extensions, such as a captcha, a chance to abort logins $abort = self::ABORTED; - $msg = null; if ( !Hooks::run( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$msg ) ) ) { $this->mAbortLoginErrorMsg = $msg;