From: Aaron Schulz Date: Fri, 10 Jul 2015 23:52:26 +0000 (-0700) Subject: Fixed bitfield check in User::loadFromId() X-Git-Tag: 1.31.0-rc.0~10812^2 X-Git-Url: http://git.cyclocoop.org/%22.htmlspecialchars%28%24url_syndic%29.%22?a=commitdiff_plain;h=e0ee2cdc4b1a24ae26d53e09f0fabe5d04ed340b;p=lhc%2Fweb%2Fwiklou.git 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 --- 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() ) {