Skip to content

Commit c60a4e2

Browse files
committed
Plugin: OnlyOffice: Fix E_NOTICEs when api_get_setting is not returning an array value
1 parent 9511cee commit c60a4e2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

plugin/onlyoffice/lib/onlyofficeAppSettings.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,22 @@ public function getSetting($settingName)
108108
}
109109
switch ($settingName) {
110110
case $this->jwtHeader:
111-
$value = api_get_setting($settingName)[$this->plugin->getPluginName()];
111+
$settings = api_get_setting($settingName);
112+
$value = is_array($settings) && array_key_exists($this->plugin->getPluginName(), $settings)
113+
? $settings[$this->plugin->getPluginName()]
114+
: null;
115+
112116
if (empty($value)) {
113117
$value = 'Authorization';
114118
}
115119
break;
116120
case $this->documentServerInternalUrl:
117-
$value = api_get_setting($settingName)[$this->plugin->getPluginName()];
121+
$settings = api_get_setting($settingName);
122+
$value = is_array($settings) ? ($settings[$this->plugin->getPluginName()] ?? null) : null;
118123
break;
119124
case $this->useDemoName:
120-
$value = api_get_setting($settingName)[0];
125+
$settings = api_get_setting($settingName);
126+
$value = is_array($settings) ? ($settings[0] ?? null) : null;
121127
break;
122128
case $this->jwtPrefix:
123129
$value = 'Bearer ';

0 commit comments

Comments
 (0)