Skip to content

Commit

Permalink
fix: Do not write default values from callbacks to settings
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Jul 11, 2024
1 parent 6fb318b commit 810e5f4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Service/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ public function set(string $uid, array $settings) : void {
if ($value !== null && array_key_exists($name, $this->attrs)) {
$settings[$name] = $value = $this->attrs[$name]['validate']($value);
}
$default = is_callable($this->attrs[$name]['default']) ? $this->attrs[$name]['default']($uid) : $this->attrs[$name]['default'];

Check warning on line 110 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / lint-php (min)

Line exceeds 120 characters; contains 139 characters

Check warning on line 110 in lib/Service/SettingsService.php

View workflow job for this annotation

GitHub Actions / lint-php (max)

Line exceeds 120 characters; contains 139 characters
if (!array_key_exists($name, $this->attrs)
|| $value === null
|| $value === $this->attrs[$name]['default']
|| $value === $default
) {
unset($settings[$name]);
}
Expand Down

0 comments on commit 810e5f4

Please sign in to comment.