diff --git a/lib/Service/SettingsService.php b/lib/Service/SettingsService.php index 8fc62a687..3385bb1c0 100644 --- a/lib/Service/SettingsService.php +++ b/lib/Service/SettingsService.php @@ -115,11 +115,12 @@ public function set(string $uid, array $settings, bool $writeDefaults = false) : if ($name === 'notesPath' && $value !== null) { continue; } + if (!array_key_exists($name, $this->attrs)) { + unset($settings[$name]); + continue; + } $default = is_callable($this->attrs[$name]['default']) ? $this->attrs[$name]['default']($uid) : $this->attrs[$name]['default']; - if (!$writeDefaults && (!array_key_exists($name, $this->attrs) - || $value === null - || $value === $default - )) { + if (!$writeDefaults && ($value === null || $value === $default)) { unset($settings[$name]); } }