Maps icon indicating copy to clipboard operation
Maps copied to clipboard

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

Open Universal-Omega opened this issue 3 years ago • 5 comments

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.

Universal-Omega avatar Apr 30 '22 17:04 Universal-Omega

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

JeroenDeDauw avatar May 02 '22 12:05 JeroenDeDauw

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}

Universal-Omega avatar Jun 07 '22 21:06 Universal-Omega

sigh MediaWiki...

JeroenDeDauw avatar Jun 07 '22 21:06 JeroenDeDauw

So I did some digging, and unless I'm wrong (untested) https://github.com/ProfessionalWiki/Maps/blob/2d18ff1b785c0ef26bb27b880068bb6c2509c653/src/MapsFactory.php#L78 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 https://github.com/ProfessionalWiki/Maps/blob/2d18ff1b785c0ef26bb27b880068bb6c2509c653/composer.json#L62, 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 avatar Jun 08 '22 16:06 Universal-Omega

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

Universal-Omega avatar Jun 10 '22 22:06 Universal-Omega