fixing the fix ;) using both, the old and the new condition is necessary to correctly saving all preferences

This commit is contained in:
ralf 2024-02-15 20:29:16 +02:00
parent c76ca96b5d
commit b0cf9bd70f

View File

@ -891,8 +891,13 @@ class Preferences
foreach($prefs as $app => $value) foreach($prefs as $app => $value)
{ {
// check if app preferences have changed, if not no need to save them // check if app preferences have changed, if not no need to save them
if ($old_prefs && !array_diff_assoc($old_prefs[$app] ?? [], $value)) continue; // we use two seemingly identical conditions (== and !array_diff_assoc()), as both are necessary
// to handle values like "" and "0" correctly (not skip updating the prefs)
if (!empty($old_prefs[$app]) && $old_prefs[$app] == $value &&
!array_diff_assoc($old_prefs[$app] ?? [], $value))
{
continue;
}
if (!$changed++) $this->db->transaction_begin(); if (!$changed++) $this->db->transaction_begin();
if (!is_array($value) || !$value) if (!is_array($value) || !$value)