Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

callback 'MapsRegistration::onRegistration' is not callable on MediaWiki 1.38 #689

Open
Universal-Omega opened this issue Apr 30, 2022 · 5 comments
Labels

Comments

@Universal-Omega
Copy link
Contributor

Setup

  • Maps version: 85d18cb
  • MW version: 1.38.0-rc.0
  • PHP version: 7.4.28

Issue

Detailed description of the issue and a stack trace if applicable:

Fatal error: Uncaught UnexpectedValueException: callback 'MapsRegistration::onRegistration' is not callable in /srv/mediawiki/w/includes/registration/ExtensionRegistry.php:572
Stack trace:
#0 /srv/mediawiki/w/includes/registration/ExtensionRegistry.php(258): ExtensionRegistry->exportExtractedData(Array)
#1 /srv/mediawiki/w/includes/Setup.php(252): ExtensionRegistry->loadFromQueue()
#2 /srv/mediawiki/w/maintenance/doMaintenance.php(96): require_once('/srv/mediawiki/...')
#3 /srv/mediawiki/w/maintenance/mergeMessageFileList.php(175): require_once('/srv/mediawiki/...')
#4 {main}
  thrown in /srv/mediawiki/w/includes/registration/ExtensionRegistry.php on line 572

Steps to reproduce the observation (recommendation is to use the sandbox):
Just trying to load MediaWiki on 1.38, or running any maintenance script, or any action at all.

@JeroenDeDauw
Copy link
Member

JeroenDeDauw commented May 2, 2022

Could you try using the master branch, and see if that fixes the issue? I made some changes that hopefully fix it.

@Universal-Omega
Copy link
Contributor Author

Universal-Omega commented Jun 7, 2022

Could you try using the master branch, and see if that fixes the issue? I made some changes that hopefully fix it.

Now I get:

Notice: Undefined index: egMapsDisableExtension in /srv/mediawiki/w/extensions/Maps/src/MapsRegistration.php on line 12

Notice: Undefined index: egMapsGMaps3Language in /srv/mediawiki/w/extensions/Maps/src/MapsSetup.php on line 38

Notice: Undefined index: egMapsGMaps3ApiKey in /srv/mediawiki/w/extensions/Maps/src/MapsSetup.php on line 47

Notice: Undefined index: egMapsEnableCoordinateFunction in /srv/mediawiki/w/extensions/Maps/src/MapsFactory.php on line 280
[dca25ae38b70d31d61185077] [no req]   TypeError: Argument 2 passed to Maps\ParserHookSetup::__construct() must be of the type bool, null given, called in /srv/mediawiki/w/extensions/Maps/src/MapsFactory.php on line 280
Backtrace:
from /srv/mediawiki/w/extensions/Maps/src/ParserHookSetup.php(23)
#0 /srv/mediawiki/w/extensions/Maps/src/MapsFactory.php(280): Maps\ParserHookSetup->__construct(Parser, NULL)
#1 /srv/mediawiki/w/extensions/Maps/src/MapsSetup.php(60): Maps\MapsFactory->newParserHookSetup(Parser)
#2 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(338): Maps\MapsSetup->Maps\{closure}(Parser)
#3 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#4 /srv/mediawiki/w/includes/HookContainer/HookRunner.php(2872): MediaWiki\HookContainer\HookContainer->run(string, array)
#5 /srv/mediawiki/w/includes/parser/Parser.php(533): MediaWiki\HookContainer\HookRunner->onParserFirstCallInit(Parser)
#6 /srv/mediawiki/w/includes/parser/ParserFactory.php(196): Parser->__construct(MediaWiki\Config\ServiceOptions, MagicWordFactory, LanguageEn, ParserFactory, string, MediaWiki\SpecialPage\SpecialPageFactory, MediaWiki\Linker\LinkRendererFactory, NamespaceInfo, Monolog\Logger, MediaWiki\BadFileLookup, MediaWiki\Languages\LanguageConverterFactory, MediaWiki\HookContainer\HookContainer, MediaWiki\Tidy\RemexDriver, WANObjectCache, MediaWiki\User\UserOptionsManager, MediaWiki\User\UserFactory, MediaWikiTitleCodec, MediaWiki\Http\HttpRequestFactory, TrackingCategories)
#7 /srv/mediawiki/w/includes/ServiceWiring.php(1211): ParserFactory->create()
#8 /srv/mediawiki/w/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}(MediaWiki\MediaWikiServices)
#9 /srv/mediawiki/w/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService(string)
#10 /srv/mediawiki/w/includes/MediaWikiServices.php(294): Wikimedia\Services\ServiceContainer->getService(string)
#11 /srv/mediawiki/w/includes/MediaWikiServices.php(1366): MediaWiki\MediaWikiServices->getService(string)
#12 /srv/mediawiki/w/extensions/TreeAndMenu/TreeAndMenu_body.php(27): MediaWiki\MediaWikiServices->getParser()
#13 [internal function]: TreeAndMenu->setup()
#14 /srv/mediawiki/w/includes/Setup.php(953): call_user_func(array)
#15 /srv/mediawiki/w/maintenance/doMaintenance.php(96): require_once(string)
#16 /srv/mediawiki/w/maintenance/sql.php(236): require_once(string)
#17 {main}

@JeroenDeDauw
Copy link
Member

sigh MediaWiki...

@Universal-Omega
Copy link
Contributor Author

So I did some digging, and unless I'm wrong (untested)

return new static( $GLOBALS, MediaWikiServices::getInstance() );
is what would set the settings property, meaning that egMapsEnableCoordinateFunction is an undefined global (null) not a boolean, resulting in in the exception. Now this means that the default globals aren't being applied (as also evident by the other undefined index warnings). So it seems to me like https://github.com/ProfessionalWiki/Maps/blob/master/DefaultSettings.php is not being applied, which appears to be loaded from https://github.com/ProfessionalWiki/Maps/blob/master/Maps_Settings.php, however that defines to only set the globals under the condition that $egMapsAvailableServices is not set? However we do set that (a modified version of it) so does that determine to never load the settings? I can't remember for sure, but I think with 1.38, there was some change with the composer autoloader load order, so that MediaWiki functions is loaded before composer autoloader, meaning configuration would be loaded before composer I think, so before that file is ever loaded with
"Maps_Settings.php"
, the settings have already been applied, so it is never set, thus the default not applied? I vaguely remembered seeing something about the load order there, but now that I went to look I can't find it so I could be completely off here.

@Universal-Omega
Copy link
Contributor Author

I did confirm that not setting $egMapsAvailableServices does in fact solve the fatal exceptions at least. So that is the cause it would appear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants