diff --git a/common.php b/common.php index 333d2e821..d6806c4a6 100644 --- a/common.php +++ b/common.php @@ -350,6 +350,18 @@ function array_deep(&$var, $fn, $one_dimensional = false, $array_only = false, $ } } +function array_deep_merge($base, $overlay) +{ + foreach ($overlay as $key => $value) { + if (is_array($value) && isset($base[$key]) && is_array($base[$key])) { + $base[$key] = array_deep_merge($base[$key], $value); + } else { + $base[$key] = $value; + } + } + return $base; +} + /** * Hide BB_PATH * diff --git a/src/Legacy/Common/User.php b/src/Legacy/Common/User.php index b1a6a6713..04104fe6f 100644 --- a/src/Legacy/Common/User.php +++ b/src/Legacy/Common/User.php @@ -632,7 +632,7 @@ class User global $lang; require(LANG_DIR . 'main.php'); setlocale(LC_ALL, $bb_cfg['lang'][$this->data['user_lang']]['locale'] ?? 'en_US.UTF-8'); - $lang += $source_lang; + $lang = array_deep_merge($source_lang, $lang); $theme = setup_style(); $DeltaTime = new DateDelta();