From 3f315881b24b38dd1b1f6df5161ddcc02c91095d Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Tue, 8 Nov 2022 20:53:54 +0100 Subject: [PATCH] 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 9ab1d92c9c48b3d82c291326ea29b3c512f0265c) --- includes/ForeignNotifications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/ForeignNotifications.php b/includes/ForeignNotifications.php index 92a09457d..c3456a3f1 100644 --- a/includes/ForeignNotifications.php +++ b/includes/ForeignNotifications.php @@ -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