Page MenuHomePhabricator

SkinAfterBottomScripts is called twice on MediaWiki 1.40.0
Closed, ResolvedPublicBUG REPORT

Description

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.):

Event Timeline

rMW11e0fba3b0cd: Deprecate global function wfReportTime() didn't introduce a duplicate call of SkinAfterBottomScripts. The call was just moved to the beginning of getBottomScripts to include the execution time of this call in the elapsed time calculation.

Change 952569 had a related patch set uploaded (by Ammarpad; author: Ammarpad):

[mediawiki/core@master] Do not run SkinAfterBottomScripts hook twice unconditionally

https://gerrit.wikimedia.org/r/952569

Change 952569 merged by jenkins-bot:

[mediawiki/core@master] Do not run SkinAfterBottomScripts hook twice unconditionally

https://gerrit.wikimedia.org/r/952569

Krinkle reopened this task as Open.EditedSep 7 2023, 10:30 PM
Krinkle subscribed.

I believe neither 1.40 nor 1.39 was fixed. Is that right?

Unfortunately the patch doesn't backport cleanly from Gerrit UI.

Change 958924 had a related patch set uploaded (by Reedy; author: Ammarpad):

[mediawiki/core@REL1_40] Do not run SkinAfterBottomScripts hook twice unconditionally

https://gerrit.wikimedia.org/r/958924

Change 958925 had a related patch set uploaded (by Reedy; author: Ammarpad):

[mediawiki/core@REL1_39] Do not run SkinAfterBottomScripts hook twice unconditionally

https://gerrit.wikimedia.org/r/958925

Unfortunately the patch doesn't backport cleanly from Gerrit UI.

Backports cleanly to REL1_40 locally...

REL1_39 needed a little more effort...

Change 958924 merged by jenkins-bot:

[mediawiki/core@REL1_40] Do not run SkinAfterBottomScripts hook twice unconditionally

https://gerrit.wikimedia.org/r/958924

Change 958925 merged by jenkins-bot:

[mediawiki/core@REL1_39] Do not run SkinAfterBottomScripts hook twice unconditionally

https://gerrit.wikimedia.org/r/958925