fix PHP 8.x Error: array_keys(): Argument #1 ($array) must be of type array, null given

This commit is contained in:
ralf 2022-12-20 09:10:10 -06:00
parent 37ff4a00a6
commit 87bf5af8e4

View File

@ -1133,7 +1133,7 @@ class Translation
// load all translations from cache at once
if ($tree_level) $lang_arr = Cache::getTree(__CLASS__, $tree_level);
if ($instance_level) $lang_arr = Cache::getInstance(__CLASS__, $instance_level);
$lang_arr = $lang_arr[$app.':en'];
$lang_arr = $lang_arr[$app.':en'] ?? [];
$ids = array_filter(array_keys($lang_arr), function($haystack) use($translation, $lang_arr) {
return stripos($lang_arr[$haystack],$translation) !== false;
});