Page MenuHomePhabricator

Title::getUserPermissionsErrors() does wierd things to StubObjects
Closed, ResolvedPublic

Description

Author: happy.melon.wiki

Description:
Should be very trivial to fix, but I a) am off to bed, and b) have a corrupted working copy at the moment, so I'll post this here:

public function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true, $ignoreErrors = array() ) {

	if( !StubObject::isRealObject( $user ) ) {
	//Since StubObject is always used on globals, we can unstub $wgUser here and set $user = $wgUser

global $wgUser;

	$wgUser->_unstub( '', 5 );
	$user = $wgUser;
	}

...

This is wrong because it is testing for stub-ness on $user, but then unconditionally unstubbing $wgUser, assuming that they must be the same. Why not just call $user->_unstub() ?? Needs investigating and patching.


Version: 1.16.x
Severity: minor

Details

Reference
bz28245

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:33 PM
bzimport set Reference to bz28245.

Assigning this back to you so that you can fix it when you wake up.

Actually you can just remove the whole check since we don't use a StubObject on $wgUser since r70970.

any fix for this yet (just checking since you said it was easy and ialex's comment makes it look even more so ;) )

happy.melon.wiki wrote:

Hehe, this was actually fixed in trunk in r74934... :D