Page MenuHomePhabricator

Title::newMainPage() doesn't split parser cache by UI language when $wgForceUIMsgAsContentMsg = ['mainpage']
Open, Needs TriagePublic

Description

A bare local interwiki, for example [[c:]] on Commons, will point to the main page (https://gerrit.wikimedia.org/g/mediawiki/core/+/b44af6c975d0271b3cf305441636de376b6d5995/includes/title/MediaWikiTitleCodec.php#441).

However, Commons has $wgForceUIMsgAsContentMsg = ['mainpage'] set, which means that the mainpage message, and therefore the main page itself, is different based on the user's UI language. So if I have my UI language set as de, the parser will turn [[c:]] into a link to https://commons.wikimedia.org/wiki/Hauptseite. But it does not record the users' language as being used in the parser cache, so regardless of what language you visit with, that page will link to the German main page.

Originally introduced in T66167: Local interwiki links with no page title should point to the main page. Semi-related is T297571: CVE-2022-28201: Title::newMainPage() goes into an infinite recursion loop if it points to a local interwiki.