From c60a4e23f5b64bf12385fb123a066259a96a9fa1 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos <1697880+AngelFQC@users.noreply.github.com> Date: Thu, 19 Dec 2024 18:54:29 -0500 Subject: [PATCH] Plugin: OnlyOffice: Fix E_NOTICEs when api_get_setting is not returning an array value --- plugin/onlyoffice/lib/onlyofficeAppSettings.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugin/onlyoffice/lib/onlyofficeAppSettings.php b/plugin/onlyoffice/lib/onlyofficeAppSettings.php index 110c51b2034..7947c935ec7 100644 --- a/plugin/onlyoffice/lib/onlyofficeAppSettings.php +++ b/plugin/onlyoffice/lib/onlyofficeAppSettings.php @@ -108,16 +108,22 @@ public function getSetting($settingName) } switch ($settingName) { case $this->jwtHeader: - $value = api_get_setting($settingName)[$this->plugin->getPluginName()]; + $settings = api_get_setting($settingName); + $value = is_array($settings) && array_key_exists($this->plugin->getPluginName(), $settings) + ? $settings[$this->plugin->getPluginName()] + : null; + if (empty($value)) { $value = 'Authorization'; } break; case $this->documentServerInternalUrl: - $value = api_get_setting($settingName)[$this->plugin->getPluginName()]; + $settings = api_get_setting($settingName); + $value = is_array($settings) ? ($settings[$this->plugin->getPluginName()] ?? null) : null; break; case $this->useDemoName: - $value = api_get_setting($settingName)[0]; + $settings = api_get_setting($settingName); + $value = is_array($settings) ? ($settings[0] ?? null) : null; break; case $this->jwtPrefix: $value = 'Bearer ';