Page MenuHomePhabricator

User::isAllowed() doesn't work as expected in the first call
Closed, InvalidPublic

Description

Author: pinei

Description:
In the first call of isAllowed(), the user object is loaded with the
loadDefaults() method, but the mGroups field remains empty.

The problem is in the code below. The mGroups field is loaded by the setToken() method but afterwards it
is cleared.

		$this->setToken(); # Random
		$this->mEmailAuthenticated = null;
		$this->mEmailToken = '';
		$this->mEmailTokenExpires = null;
		$this->mRegistration = wfTimestamp( TS_MW );
		$this->mGroups = array();

Version: 1.9.x
Severity: normal
OS: Windows XP
Platform: PC

Details

Reference
bz9576

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:37 PM
bzimport set Reference to bz9576.
bzimport added a subscriber: Unknown Object (MLST).

First call of what?

Nothing should be getting set by that setToken() call except for $this->mToken;
$this->mDataLoaded will have already been set before the call to loadDefaults(),
so the $this->load() call in setToken() won't change anything.

Can you give an example of how the described behavior is triggered?

pinei wrote:

I could not reproduce again with the original User.php. An extension I have
used (canAccessNamespace() extension) should have caused the problem.

I am invalidating the bug.