Page MenuHomePhabricator

Calling 'userCanAuthenticate' results in a PHP error
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Install and enable PluggableAuth
  • From an extension, call the userCanAuthenticate function in the AuthManager:
\MediaWiki\MediaWikiServices::getInstance()->getAuthManager()->userCanAuthenticate( 'Eleanor Rigby' );

What happens?:
A fatal error is thrown:

PHP Error:  Class 'MediaWiki/Permissions/Authority' not found in /mediawiki-1.35.6-permissions/extensions/PluggableAuth/includes/PrimaryAuthenticationProvider.php on line 230

What should have happened instead?:
true or false should be returned, depending on whether the user can authenticate.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
MediaWiki 1.35.6 with PluggableAuth 6.0.

Event Timeline

Xxmarijnw renamed this task from Calling `userCanAuthenticate` results in `PHP Error` to Calling 'userCanAuthenticate' results in a PHP error.May 20 2022, 2:45 PM

Because of this bug, Structured Discussion does not work in conjunction with PluggableAuth.

Ah, I see. We should not refer to Authority, since it was not introduced until after 1.35. I think that it is only used for a default value for a parameter, so we should be able to work around it. Thanks for reporting! Please feel free to submit a patch.

Change 794773 had a related patch set uploaded (by Cicalese; author: Cicalese):

[mediawiki/extensions/PluggableAuth@master] Remove reference to Authority to keep backward compatibility with MW 1.35

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

Change 794773 merged by jenkins-bot:

[mediawiki/extensions/PluggableAuth@master] Remove reference to Authority to keep backward compatibility with MW 1.35

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

Change 799458 had a related patch set uploaded (by Cicalese; author: Cicalese):

[mediawiki/extensions/PluggableAuth@REL1_38] Remove reference to Authority to keep backward compatibility with MW 1.35

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

Change 799458 merged by jenkins-bot:

[mediawiki/extensions/PluggableAuth@REL1_38] Remove reference to Authority to keep backward compatibility with MW 1.35

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

cicalese claimed this task.
cicalese triaged this task as High priority.
cicalese moved this task from Backlog to Closed on the MediaWiki-extensions-Pluggable-Auth board.