Skip to content

Commit

Permalink
Fix storing "empty" values in rcube_cache/rcube_cache_shared (#5519)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Nov 16, 2016
1 parent c633e60 commit 7f04df9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------
Expand Down
9 changes: 4 additions & 5 deletions program/lib/Roundcube/rcube_cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private function read_record($key, $nostore=false)
}
}

if ($data) {
if ($data !== false) {
$md5sum = md5($data);
$data = $this->unserialize($data);

Expand All @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions program/lib/Roundcube/rcube_cache_shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private function read_record($key, $nostore=false)
}
}

if ($data) {
if ($data !== false) {
$md5sum = md5($data);
$data = $this->unserialize($data);

Expand All @@ -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) {
Expand Down

0 comments on commit 7f04df9

Please sign in to comment.