From 1101fb21d8002daac691f1193f668b15370e683e Mon Sep 17 00:00:00 2001 From: JediKev <kevin@enhancesoft.com> Date: Fri, 31 Mar 2017 18:30:16 -0500 Subject: [PATCH] i18n: Fix getPrimaryLanguage() on non-object This addresses issues #1964 & #3668 where $cfg might be null and cause a non-object error. Check if $cfg is set, if not return the default en_US language. --- include/class.i18n.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/class.i18n.php b/include/class.i18n.php index ac6db0a33..513e3ab31 100644 --- a/include/class.i18n.php +++ b/include/class.i18n.php @@ -364,7 +364,7 @@ class Internationalization { return $lang = self::isLanguageInstalled($best_match_langcode) ? $best_match_langcode - : $cfg->getPrimaryLanguage(); + : ($cfg ? $cfg->getPrimaryLanguage() : 'en_US'); } static function getCurrentLanguage($user=false) { -- GitLab