Page MenuHomePhabricator

PermissionManager::missingPermissionError ignores $short
Closed, ResolvedPublicBUG REPORT

Description

PermissionManager::missingPermissionError takes a $short parameter that is meant to return early and not build an expensive error for "quick" permission checks that just need a boolean and don't need to display the error anywhere:
// We avoid expensive display logic for quickUserCan's and such

It stopped doing the early return in 1.43 because the line

return [ 'badaccess-group0' ];

was replaced with

$status->fatal( 'badaccess-group0' );

which no longer has a return, and continues on with the expensive error creation later in the function, even though it doesn't use it.

I *think* the fix is as simple as changing to

return $status->fatal( 'badaccess-group0' );

@matmarex can you confirm?

Event Timeline

Yeah, you're right, that's my mistake. Would you like to submit a patch or shall I?

Change #1170546 had a related patch set uploaded (by TehKittyCat; author: TehKittyCat):

[mediawiki/core@master] PermissionManager: Fix missingPermissionError() not returning early when $short is true.

https://gerrit.wikimedia.org/r/1170546

Thank you! I suppose this should be backported to 1.43 and 1.44.

Change #1170546 merged by jenkins-bot:

[mediawiki/core@master] PermissionManager: Fix missingPermissionError() not returning early when $short is true.

https://gerrit.wikimedia.org/r/1170546

Change #1170599 had a related patch set uploaded (by Bartosz Dziewoński; author: TehKittyCat):

[mediawiki/core@REL1_43] PermissionManager: Fix missingPermissionError() not returning early when $short is true.

https://gerrit.wikimedia.org/r/1170599

Change #1170600 had a related patch set uploaded (by Bartosz Dziewoński; author: TehKittyCat):

[mediawiki/core@REL1_44] PermissionManager: Fix missingPermissionError() not returning early when $short is true.

https://gerrit.wikimedia.org/r/1170600

Change #1170600 merged by jenkins-bot:

[mediawiki/core@REL1_44] PermissionManager: Fix missingPermissionError() not returning early when $short is true.

https://gerrit.wikimedia.org/r/1170600

Change #1170599 merged by jenkins-bot:

[mediawiki/core@REL1_43] PermissionManager: Fix missingPermissionError() not returning early when $short is true.

https://gerrit.wikimedia.org/r/1170599

• matmarex assigned this task to TehKittyCat.

Thanks for the patch!