Skip to content

Commit 726a8dc

Browse files
juliusknorrbackportbot[bot]
authored andcommitted
fix: Do not write default values from callbacks to settings
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent d15ea3c commit 726a8dc

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/Service/SettingsService.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ public function set(string $uid, array $settings) : void {
107107
if ($value !== null && array_key_exists($name, $this->attrs)) {
108108
$settings[$name] = $value = $this->attrs[$name]['validate']($value);
109109
}
110+
$default = is_callable($this->attrs[$name]['default']) ? $this->attrs[$name]['default']($uid) : $this->attrs[$name]['default'];
110111
if (!array_key_exists($name, $this->attrs)
111112
|| $value === null
112-
|| $value === $this->attrs[$name]['default']
113+
|| $value === $default
113114
) {
114115
unset($settings[$name]);
115116
}

0 commit comments

Comments
 (0)