SimpleMachines / smf-mw-auth

SMF MediaWiki Authentication
https://www.simplemachines.org
Other
23 stars 18 forks source link

Error when not logged in in v1.41 #27

Open berianwilliams opened 1 month ago

berianwilliams commented 1 month ago

Description

In v1.4.1 they changed the function signature of TemporaryPasswordPrimaryAuthenticationProvider (1.40 vs 1.41), which results in the following error:

Original exception: [55272281e6a09665700b0a41] /wiki/Main_Page/history TypeError: MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider::__construct(): Argument #1 ($dbProvider) must be of type Wikimedia\Rdbms\IConnectionProvider, Wikimedia\Rdbms\LoadBalancer given, called in /var/www/html/w/extensions/ForumSsoProvider/ForumAuthManager.php on line 36 Backtrace: from /var/www/html/w/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php(74)

0 /var/www/html/w/extensions/ForumSsoProvider/ForumAuthManager.php(36): MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider->__construct(Wikimedia\Rdbms\LoadBalancer, MediaWiki\User\UserOptionsManager, array)

1 /var/www/html/w/vendor/wikimedia/object-factory/src/ObjectFactory.php(240): ForumAuthManager->__construct()

2 /var/www/html/w/vendor/wikimedia/object-factory/src/ObjectFactory.php(149): Wikimedia\ObjectFactory\ObjectFactory::getObjectFromSpec(array, array)

3 /var/www/html/w/includes/auth/AuthManager.php(2496): Wikimedia\ObjectFactory\ObjectFactory->createObject(array, array)

4 /var/www/html/w/includes/auth/AuthManager.php(2541): MediaWiki\Auth\AuthManager->providerArrayFromSpecs(string, array)

5 /var/www/html/w/includes/auth/AuthManager.php(1051): MediaWiki\Auth\AuthManager->getPrimaryAuthenticationProviders()

6 /var/www/html/w/includes/skins/SkinTemplate.php(535): MediaWiki\Auth\AuthManager->canCreateAccounts()

7 /var/www/html/w/includes/skins/SkinTemplate.php(501): SkinTemplate->useCombinedLoginLink()

8 /var/www/html/w/includes/skins/SkinTemplate.php(1035): SkinTemplate->buildPersonalUrls(boolean)

9 /var/www/html/w/includes/skins/SkinTemplate.php(604): SkinTemplate->buildContentNavigationUrlsInternal()

10 /var/www/html/w/includes/skins/SkinTemplate.php(181): SkinTemplate->getPortletsTemplateData()

11 /var/www/html/w/includes/skins/SkinMustache.php(125): SkinTemplate->getTemplateData()

12 /var/www/html/w/skins/Vector/includes/SkinVectorLegacy.php(161): SkinMustache->getTemplateData()

13 /var/www/html/w/includes/skins/SkinMustache.php(92): MediaWiki\Skins\Vector\SkinVectorLegacy->getTemplateData()

14 /var/www/html/w/includes/skins/SkinTemplate.php(174): SkinMustache->generateHTML()

15 /var/www/html/w/includes/Output/OutputPage.php(2947): SkinTemplate->outputPage()

16 /var/www/html/w/includes/MediaWiki.php(978): MediaWiki\Output\OutputPage->output(boolean)

17 /var/www/html/w/includes/MediaWiki.php(613): MediaWiki->main()

18 /var/www/html/w/index.php(50): MediaWiki->run()

19 /var/www/html/w/index.php(46): wfIndexMain()

20 {main}

This only seems to occur if you aren't logged into SMF, looks like it works fine when you're already logged in.

@jdarwood007 I don't know MediaWiki well enough to fix it myself, but it'd be great if you could please take a look?

Steps to reproduce

  1. Upgrade to MediaWiki >= v1.41.
  2. Install latest smf-mw-auth extension from master.
  3. Log out of SMF.
  4. Hit any page on the wiki; I tried /wiki/Main_Page/history.

Environment (complete as necessary)

Additional information/references

berianwilliams commented 4 weeks ago

Turned out to be a really simple fix, and seems to work with and without logging in again!

jdarwood007 commented 5 days ago

You are welcome to submit that as a PR against master. I branched the code so it can be updated to support 1.43 in the future, but haven't had time to look at the changes in 1.40, 1.41 and the upcoming changes in 1.42

berianwilliams commented 5 days ago

You are welcome to submit that as a PR against master. I branched the code so it can be updated to support 1.43 in the future, but haven't had time to look at the changes in 1.40, 1.41 and the upcoming changes in 1.42

Done!