From e0ee2cdc4b1a24ae26d53e09f0fabe5d04ed340b Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 10 Jul 2015 16:52:26 -0700 Subject: [PATCH] Fixed bitfield check in User::loadFromId() * READ_LOCKING is a composite field, so it can yeild 00, 01, 10, or 11 for the relevant two bits. Only one of them should pass the check to avoid locking and snapshot breaking queries for no reason. Change-Id: Ief04ac20c7639fcf79443a3ee39a471542a59551 --- includes/User.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/User.php b/includes/User.php index 63c0d37e45..26d54ab396 100644 --- a/includes/User.php +++ b/includes/User.php @@ -387,7 +387,8 @@ class User implements IDBAccessObject { // Try cache (unless this needs to lock the DB). // NOTE: if this thread called saveSettings(), the cache was cleared. - if ( ( $flags & self::READ_LOCKING ) || !$this->loadFromCache() ) { + $locking = ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING ); + if ( $locking || !$this->loadFromCache() ) { wfDebug( "User: cache miss for user {$this->mId}\n" ); // Load from DB (make sure this thread sees its own changes) if ( wfGetLB()->hasOrMadeRecentMasterChanges() ) { -- 2.20.1