From fd48714615dfc9554cbf8b097bcb80682e6c8d69 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Wed, 22 Apr 2020 09:34:25 +0100 Subject: [PATCH] fix issue reported with __LANG.$var - https://github.com/postfixadmin/postfixadmin/commit/844840c6a8e90098dd83dccb88ca96317863de4b#commitcomment-38653465 --- model/Config.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/model/Config.php b/model/Config.php index 7eabfd68..6e415d69 100644 --- a/model/Config.php +++ b/model/Config.php @@ -115,7 +115,7 @@ final class Config { } if (!in_array($var, self::$deprecated_options)) { - error_log('Config::read(): attempt to read undefined config option "' . $var . '", returning null'); + error_log('Config::read(): attempt to read undefined config option "' . $var . '", returning null' . json_encode(debug_backtrace(), true)); } return null; @@ -198,15 +198,15 @@ final class Config { * @access public */ public static function lang($var) { - $value = self::read("__LANG.{$var}"); - if (is_null($value)) { - return ''; - } + $languages = self::read_array('__LANG'); + + $value = $languages[$var] ?? ''; if (!is_string($value)) { trigger_error('In ' . __FUNCTION__ . ": expected config $var to be a string , but received a " . gettype($value), E_USER_ERROR); } + return $value; }