Steps to replicate the issue (include links if applicable):
Use following code in LocalSettings.php:
$wgHooks['SkinAfterBottomScripts'][] = static function ( $skin, &$text ) { echo wfGetAllCallers(20) . "\n\n"; };
What happens?:
wfIndexMain/MediaWiki->run/MediaWiki->main/OutputPage->output/SkinTemplate->outputPage/SkinMustache->generateHTML/OutputPage->tailElement/MediaWiki\HookContainer\HookRunner->onSkinAfterBottomScripts/MediaWiki\HookContainer\HookContainer->run/MediaWiki\HookContainer\HookContainer->callLegacyHook/{closure} wfIndexMain/MediaWiki->run/MediaWiki->main/OutputPage->output/SkinTemplate->outputPage/SkinMustache->generateHTML/OutputPage->tailElement/OutputPage->getBottomScripts/MediaWiki\HookContainer\HookRunner->onSkinAfterBottomScripts/MediaWiki\HookContainer\HookContainer->run/MediaWiki\HookContainer\HookContainer->callLegacyHook/{closure}
What should have happened instead?:
Expected that the hook is only called once.
Software version (skip for WMF-hosted wikis like Wikipedia):
MediaWiki 1.40.0
Other information (browser name/version, screenshots, etc.):