From 92e36f6839534534f2862197ea38be4dba886d95 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 16 Jun 2015 11:39:55 +0200 Subject: [PATCH] Fix race-condition in saving user preferences and loading plugin config (#1490431) --- CHANGELOG | 1 + program/lib/Roundcube/rcube_user.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f2322f4e0..a2921eab8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ CHANGELOG Roundcube Webmail - Fix Compose action in addressbook for results from multiple addressbooks (#1490413) - Fix bug where some messages in multi-folder search couldn't be opened (#1490426) - Fix unintentional messages list page change on page switch in compose addressbook (#1490427) +- Fix race-condition in saving user preferences and loading plugin config (#1490431) RELEASE 1.1.2 ------------- diff --git a/program/lib/Roundcube/rcube_user.php b/program/lib/Roundcube/rcube_user.php index b9c9957cb..f6fc21f10 100644 --- a/program/lib/Roundcube/rcube_user.php +++ b/program/lib/Roundcube/rcube_user.php @@ -195,8 +195,9 @@ class rcube_user // don't save prefs with default values if they haven't been changed yet foreach ($a_user_prefs as $key => $value) { - if ($value === null || (!isset($old_prefs[$key]) && ($value == $config->get($key)))) + if ($value === null || (!isset($old_prefs[$key]) && ($value == $config->get($key)))) { unset($save_prefs[$key]); + } } $save_prefs = serialize($save_prefs); @@ -217,7 +218,7 @@ class rcube_user $this->data['preferences'] = $save_prefs; if (!$no_session) { - $config->set_user_prefs($a_user_prefs); + $config->set_user_prefs($this->prefs); if (isset($_SESSION['preferences'])) { $this->rc->session->remove('preferences'); @@ -235,7 +236,7 @@ class rcube_user ) { $_SESSION['preferences'] = $save_prefs; $_SESSION['preferences_time'] = time(); - $config->set_user_prefs($a_user_prefs); + $config->set_user_prefs($this->prefs); $this->data['preferences'] = $save_prefs; }