Page MenuHomePhabricator

MediaWiki 1.36 Google Login bug: Error: Undefined class constant 'VERSION'
Closed, InvalidPublicBUG REPORT

Description

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

  • Try to login via Google
  • Receive error

What happens?:
Error

What should have happened instead?:
Logged in

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
1.36.2

Error: Undefined class constant 'VERSION'

Backtrace:

from /var/www/sub/wiki/extensions/GoogleLogin/vendor/google/apiclient/src/Google/Client.php(1042)
#0 /var/www/sub/wiki/extensions/GoogleLogin/vendor/google/apiclient/src/Google/Client.php(1032): Google_Client->createDefaultHttpClient()
#1 /var/www/sub/wiki/extensions/GoogleLogin/vendor/google/apiclient/src/Google/Client.php(190): Google_Client->getHttpClient()
#2 /var/www/sub/wiki/extensions/GoogleLogin/includes/Auth/GooglePrimaryAuthenticationProvider.php(413): Google_Client->fetchAccessTokenWithAuthCode(string)
#3 /var/www/sub/wiki/extensions/GoogleLogin/includes/Auth/GooglePrimaryAuthenticationProvider.php(55): GoogleLogin\Auth\GooglePrimaryAuthenticationProvider->getVerifiedToken(GoogleLogin\Auth\GoogleServerAuthenticationRequest)
#4 /var/www/sub/wiki/includes/auth/AuthManager.php(559): GoogleLogin\Auth\GooglePrimaryAuthenticationProvider->continuePrimaryAuthentication(array)
#5 /var/www/sub/wiki/includes/specialpage/AuthManagerSpecialPage.php(374): MediaWiki\Auth\AuthManager->continueAuthentication(array)
#6 /var/www/sub/wiki/includes/specialpage/AuthManagerSpecialPage.php(502): AuthManagerSpecialPage->performAuthenticationStep(string, array)
#7 /var/www/sub/wiki/includes/htmlform/HTMLForm.php(715): AuthManagerSpecialPage->handleFormSubmit(array, VFormHTMLForm)
#8 /var/www/sub/wiki/includes/specialpage/AuthManagerSpecialPage.php(435): HTMLForm->trySubmit()
#9 /var/www/sub/wiki/includes/specialpage/LoginSignupSpecialPage.php(320): AuthManagerSpecialPage->trySubmit()
#10 /var/www/sub/wiki/includes/specialpage/SpecialPage.php(646): LoginSignupSpecialPage->execute(NULL)
#11 /var/www/sub/wiki/includes/specialpage/SpecialPageFactory.php(1386): SpecialPage->run(NULL)
#12 /var/www/sub/wiki/includes/MediaWiki.php(309): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#13 /var/www/sub/wiki/includes/MediaWiki.php(913): MediaWiki->performRequest()
#14 /var/www/sub/wiki/includes/MediaWiki.php(546): MediaWiki->main()
#15 /var/www/sub/wiki/index.php(53): MediaWiki->run()
#16 /var/www/sub/wiki/index.php(46): wfIndexMain()
#17 {main}

Event Timeline

You can just look for "ClientInterface::VERSION"

Looks like the upstream fix is https://github.com/googleapis/google-api-php-client/commit/b1f0964528446dac8e979b6b3babf8a185fa538a after this constant being deprecated in https://github.com/guzzle/guzzle/commit/4ef5723c06c2fa7b3f07ea91c7e218925700c47a#diff-7fe9d7bab1528c58fb39365621c6f02430dd01828c26fe8b00f0408de72c71b8

And the problem presumably comes from MW core requiring guzzle 7...

So really, the version of google/apiclient needs updating in the extension away from ^2.0.0@RC, to something at least >=v2.6.0. I don't know if there are any related breaking changes though

Did you not seen any warnings from composer about being unable to fulfil constraints?

In the meantime I have already updated to:

"require": {
"google/apiclient": "^2.11.0",

Same error occurs.

No composer errors or warnings given with the previous or current version.

I'm not sure how the "same error" can occur...

In 2.11.0 the code has clearly been updated - https://github.com/googleapis/google-api-php-client/blame/v2.11.0/src/Client.php#L1163-L1168 and is wrapped by a check to see the constants exist/are defined..

Actually, scratch that. After updating api-client in both the main (Mediawiki composer folder) and the extension folder, it is working.

But this whole multiplying of vendor folders is just really bad decision causing such errors as this one!

You shouldn't be doing that..

If you follow https://www.mediawiki.org/wiki/Composer#Using_composer-merge-plugin you don't need to run composer in the extensions folder...

Also... I've just realised that ^2.0.0@RC does actually resolve to v2.11.0 as the newest version thanks to the ^ (I wasn't sure with the @RC)... No bump of the version of google/apiclient in GoogleLogin's composer.json is necessary...

See https://semver.mwl.be/?package=google/apiclient&constraint=^2.0.0@RC&stability=stable

Screenshot 2021-11-03 at 14.07.05.png (612×2 px, 136 KB)

So it just looks like you haven't kept everything up to date...

OK, thanks. You can mark it as resolved.