Fix PHP 8.1 compatibility issue in ForeignNotifications

Passing null to functions that expect a string is no longer allowed.
Here in this code it can apparently only happen in test scenarios.
That's why I use a very minimal workround that still calls the same
code. The lookup will return an empty string and trigger the expected
code path below.

Bug: T311448
Change-Id: If04924a22b82ae29b8f9327668e8965d6d2a490d
(cherry picked from commit 9ab1d92c9c)
This commit is contained in:
thiemowmde 2022-11-08 20:53:54 +01:00 committed by Reedy
parent 3f652a39c4
commit 3f315881b2

View file

@ -243,7 +243,7 @@ class EchoForeignNotifications {
// try to fetch site name for this specific wiki, or fallback to the
// general project's sitename if there is no override
$wikiName = $wgConf->get( 'wgSitename', $wikiId ) ?: $wgConf->get( 'wgSitename', $site );
$langName = Language::fetchLanguageName( $langCode, $wgLang->getCode() );
$langName = Language::fetchLanguageName( $langCode ?? '', $wgLang->getCode() );
if ( !$langName ) {
// if we can't find a language name (in language-agnostic