From 4dc17cf59142b3d3d80e9b3cdba77e7db0d2b75c Mon Sep 17 00:00:00 2001 From: Jonty Sewell Date: Wed, 3 Feb 2016 11:41:34 +0000 Subject: If attempting to write an empty session to Redis, a key will not actually be created, so when the driver tries to set the expiration timeout on the key, 0 is returned, triggering a warning from session_write_close Signed-off-by: Jonty Sewell --- system/libraries/Session/drivers/Session_redis_driver.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'system/libraries/Session/drivers/Session_redis_driver.php') diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php index c7c574202..aa8459bef 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -240,9 +240,15 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle return $this->_failure; } - return ($this->_redis->setTimeout($this->_key_prefix.$session_id, $this->_config['expiration'])) - ? $this->_success - : $this->_failure; + if($this->_fingerprint === md5('')) + { + // A blank session will not be written to redis, so a timeout cannot be set on it + return $this->_success; + } else { + return ($this->_redis->setTimeout($this->_key_prefix.$session_id, $this->_config['expiration'])) + ? $this->_success + : $this->_failure; + } } return $this->_failure; -- cgit v1.2.3-24-g4f1b