From 7bbb86f78aad9c9ed71054e9e5f9ab01a9c04b17 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 19 Sep 2015 08:35:35 +0200 Subject: [PATCH] Session read handler must return a string in PHP7 --- program/lib/Roundcube/rcube_session.php | 12 +++++++----- program/lib/Roundcube/rcube_session_db.php | 2 ++ program/lib/Roundcube/rcube_session_redis.php | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/program/lib/Roundcube/rcube_session.php b/program/lib/Roundcube/rcube_session.php index af6a49b1d..23b1d33e0 100644 --- a/program/lib/Roundcube/rcube_session.php +++ b/program/lib/Roundcube/rcube_session.php @@ -157,7 +157,7 @@ abstract class rcube_session $oldvars = $this->get_cache($key); // if there are cached vars, update store, else insert new data - if ($oldvars !== null) { + if ($oldvars) { $newvars = $this->_fixvars($vars, $oldvars); return $this->update($key, $newvars, $oldvars); } @@ -267,10 +267,11 @@ abstract class rcube_session } /** - * see if we have vars of this key already cached, and if so, return them. + * See if we have vars of this key already cached, and if so, return them. * - * @param $key - * @return null|array + * @param string $key Session ID + * + * @return string */ protected function get_cache($key) { @@ -285,6 +286,7 @@ abstract class rcube_session else { // else read data again $cache = $this->read($key); } + return $cache; } @@ -374,7 +376,7 @@ abstract class rcube_session $node[$k] = $value; } - if($this->key) { + if ($this->key) { $data = $this->read($this->key); } diff --git a/program/lib/Roundcube/rcube_session_db.php b/program/lib/Roundcube/rcube_session_db.php index 683ca37ee..6b996995b 100644 --- a/program/lib/Roundcube/rcube_session_db.php +++ b/program/lib/Roundcube/rcube_session_db.php @@ -108,6 +108,8 @@ class rcube_session_db extends rcube_session return !empty($this->vars) ? (string) $this->vars : ''; } + + return ''; } /** diff --git a/program/lib/Roundcube/rcube_session_redis.php b/program/lib/Roundcube/rcube_session_redis.php index 74c06f57b..7a72b1fc1 100644 --- a/program/lib/Roundcube/rcube_session_redis.php +++ b/program/lib/Roundcube/rcube_session_redis.php @@ -169,6 +169,8 @@ class rcube_session_redis extends rcube_session { return !empty($this->vars) ? (string) $this->vars : ''; } + + return ''; } /**