summaryrefslogtreecommitdiffstats
path: root/system/libraries/Session
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-01-07 12:55:21 +0100
committerAndrey Andreev <narf@devilix.net>2016-01-07 12:55:21 +0100
commit79b8a086187f199bb708bd56477850fbf1dd9e91 (patch)
tree7368f7217c278bcc0af3ac6927195066103b65f9 /system/libraries/Session
parent0ca9ae6ca109177eb0e80456b097a9d63412517e (diff)
Fix #4362
Diffstat (limited to 'system/libraries/Session')
-rw-r--r--system/libraries/Session/drivers/Session_memcached_driver.php5
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php5
2 files changed, 8 insertions, 2 deletions
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php
index 760239dfb..9d7ab1172 100644
--- a/system/libraries/Session/drivers/Session_memcached_driver.php
+++ b/system/libraries/Session/drivers/Session_memcached_driver.php
@@ -300,7 +300,10 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
*/
protected function _get_lock($session_id)
{
- if (isset($this->_lock_key))
+ // PHP 7 reuses the SessionHandler object on regeneration,
+ // so we need to check here if the lock key is for the
+ // correct session ID.
+ if ($this->_lock_key === $this->_key_prefix.$session_id.':lock')
{
return ($this->_memcached->replace($this->_lock_key, time(), 300))
? $this->_success
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index b60ef6b34..a31c45372 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -314,7 +314,10 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
*/
protected function _get_lock($session_id)
{
- if (isset($this->_lock_key))
+ // PHP 7 reuses the SessionHandler object on regeneration,
+ // so we need to check here if the lock key is for the
+ // correct session ID.
+ if ($this->_lock_key === $this->_key_prefix.$session_id.':lock')
{
return $this->_redis->setTimeout($this->_lock_key, 300);
}