List of steps to reproduce (step by step, including full links if applicable):
- install MediaWiki
- install the Minerva skin
- configure $wgRightsIcon and $wgRightsText (e.g. "$wgResourceBasePath/resources/assets/licenses/cc-0.png" and "Creative Commons Zero (Public Domain)")
- don’t customize $wgFooterIcons
- load a page with the Minerva skin
To see it live:
- Open Not Wikilambda with the Minerva skin and $wgFooterIcons not configured, using this link
What happens?:
MediaWiki internal error. Original exception: [cd825e51c258fe8c7c6c8517] /w/index.php?title=Z10157&mobileaction=toggle_view_mobile TypeError: Return value of BaseTemplate::getCopyrightIconHTML() must be of the type string, array returned Backtrace: from /data/project/notwikilambda/public_html/w/includes/skins/BaseTemplate.php(60) #0 /data/project/notwikilambda/public_html/w/includes/skins/SkinTemplate.php(382): BaseTemplate::getCopyrightIconHTML(GlobalVarConfig) #1 /data/project/notwikilambda/public_html/w/skins/MinervaNeue/includes/Skins/SkinMinerva.php(125): SkinTemplate->prepareQuickTemplate() #2 /data/project/notwikilambda/public_html/w/skins/MinervaNeue/includes/Skins/SkinMinerva.php(78): SkinMinerva->prepareQuickTemplate() #3 /data/project/notwikilambda/public_html/w/includes/skins/SkinMustache.php(56): SkinMinerva->getTemplateData() #4 /data/project/notwikilambda/public_html/w/includes/skins/SkinTemplate.php(144): SkinMustache->generateHTML() #5 /data/project/notwikilambda/public_html/w/includes/OutputPage.php(2644): SkinTemplate->outputPage() #6 /data/project/notwikilambda/public_html/w/includes/MediaWiki.php(939): OutputPage->output(boolean) #7 /data/project/notwikilambda/public_html/w/includes/MediaWiki.php(952): MediaWiki::{closure}() #8 /data/project/notwikilambda/public_html/w/includes/MediaWiki.php(559): MediaWiki->main() #9 /data/project/notwikilambda/public_html/w/index.php(53): MediaWiki->run() #10 /data/project/notwikilambda/public_html/w/index.php(46): wfIndexMain() #11 {main}
What should have happened instead?:
No crash.
Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
MediaWiki core 01dea43, MinervaNeue be64114
I think this is a MediaWiki core bug. Here’s BaseTemplate::getCopyrightIconHTML():
/** * @internal for usage by BaseTemplate or SkinTemplate. * @param Config $config * @return string */ public static function getCopyrightIconHTML( Config $config ): string { $out = ''; $footerIcons = $config->get( 'FooterIcons' ); if ( isset( $footerIcons['copyright']['copyright'] ) && $footerIcons['copyright']['copyright'] ) { $out = $footerIcons['copyright']['copyright']; } elseif ( $config->get( 'RightsIcon' ) ) { $icon = htmlspecialchars( $config->get( 'RightsIcon' ) ); $url = $config->get( 'RightsUrl' ); if ( $url ) { $out .= '<a href="' . htmlspecialchars( $url ) . '">'; } $text = htmlspecialchars( $config->get( 'RightsText' ) ); $out .= "<img src=\"$icon\" alt=\"$text\" width=\"88\" height=\"31\" />"; if ( $url ) { $out .= '</a>'; } } return $out; }
This effectively returns $wgFooterIcons['copyright']['copyright']. And here’s the default value of $wgFooterIcons:
$wgFooterIcons = [ "copyright" => [ "copyright" => [], // placeholder for the built in copyright icon ], "poweredby" => [ "mediawiki" => [ // Defaults to point at // "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png" // plus srcset for 1.5x, 2x resolution variants. "src" => null, "url" => "https://www.mediawiki.org/", "alt" => "Powered by MediaWiki", ] ], ];
$wgFooterIcons['copyright']['copyright'] is an array. Returning it from getCopyrightIconHTML(), which declares a return type of string, will cause a crash.