diff --git a/CHANGELOG b/CHANGELOG index dc9ce07cfe1..ec926417532 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,7 @@ CHANGELOG Roundcube Webmail - Fix bug where it wasn't possible to store more that 2MB objects in memcache/apc, Added memcache_max_allowed_packet and apc_max_allowed_packet settings (#5452) - Fix "Illegal string offset" warning in rcube::log_bug() on PHP 7.1 (#5508) +- Fix storing "empty" values in rcube_cache/rcube_cache_shared (#5519) RELEASE 1.2.2 ------------- diff --git a/program/lib/Roundcube/rcube_cache.php b/program/lib/Roundcube/rcube_cache.php index 7858d6d4ec0..8bdbee843ab 100644 --- a/program/lib/Roundcube/rcube_cache.php +++ b/program/lib/Roundcube/rcube_cache.php @@ -280,7 +280,7 @@ private function read_record($key, $nostore=false) } } - if ($data) { + if ($data !== false) { $md5sum = md5($data); $data = $this->unserialize($data); @@ -306,10 +306,9 @@ private function read_record($key, $nostore=false) 0, 1, $this->userid, $this->prefix.'.'.$key); if ($sql_arr = $this->db->fetch_assoc($sql_result)) { - $key = substr($sql_arr['cache_key'], strlen($this->prefix)+1); - $md5sum = $sql_arr['data'] ? md5($sql_arr['data']) : null; - if ($sql_arr['data']) { - $data = $this->unserialize($sql_arr['data']); + if (strlen($sql_arr['data']) > 0) { + $md5sum = md5($sql_arr['data']); + $data = $this->unserialize($sql_arr['data']); } if ($nostore) { diff --git a/program/lib/Roundcube/rcube_cache_shared.php b/program/lib/Roundcube/rcube_cache_shared.php index fcb05dea8c1..79f47d7afd3 100644 --- a/program/lib/Roundcube/rcube_cache_shared.php +++ b/program/lib/Roundcube/rcube_cache_shared.php @@ -275,7 +275,7 @@ private function read_record($key, $nostore=false) } } - if ($data) { + if ($data !== false) { $md5sum = md5($data); $data = $this->unserialize($data); @@ -301,9 +301,9 @@ private function read_record($key, $nostore=false) 0, 1, $this->prefix . '.' . $key); if ($sql_arr = $this->db->fetch_assoc($sql_result)) { - $md5sum = $sql_arr['data'] ? md5($sql_arr['data']) : null; - if ($sql_arr['data']) { - $data = $this->unserialize($sql_arr['data']); + if (strlen($sql_arr['data']) > 0) { + $md5sum = md5($sql_arr['data']); + $data = $this->unserialize($sql_arr['data']); } if ($nostore) {