From 2f93873a7c16befb5d79a3e8b1658533b3e54726 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 30 Jul 2022 07:28:01 +0000 Subject: [PATCH] PHP8.1 Fix issue with passing NULL value for locale into string function --- src/PhpWord/Style/Language.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index 7b2de51e07..7f3dbec767 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -232,7 +232,7 @@ private function validateLocale($locale) $locale = str_replace('_', '-', $locale); } - if (strlen($locale) === 2) { + if ($locale !== null && strlen($locale) === 2) { return strtolower($locale) . '-' . strtoupper($locale); }