From 780c368b5e4231daffd415ce8911c2c0fb56b70f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Wed, 18 Nov 2015 16:42:39 -0800 Subject: [PATCH] Update cached user ID after user is added to the database Bug: T119021 Change-Id: I5e0599d1d045b0389a7825fddc2b346e4cfd001d --- includes/User.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/User.php b/includes/User.php index b09e4e456e..611f603270 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2423,7 +2423,7 @@ class User implements IDBAccessObject { * through the web interface. */ private function setPasswordInternal( $str ) { - $id = self::idFromName( $this->getName() ); + $id = self::idFromName( $this->getName(), self::READ_LATEST ); if ( $id == 0 ) { throw new LogicException( 'Cannot set a password for a user that is not in the database.' ); } @@ -3898,6 +3898,7 @@ class User implements IDBAccessObject { return Status::newFatal( 'userexists' ); } $this->mId = $dbw->insertId(); + self::$idCacheByName[$this->mName] = $this->mId; // Clear instance cache other than user table data, which is already accurate $this->clearInstanceCache(); -- 2.20.1