summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Long <mchobbylong@gmail.com>2019-08-13 21:22:16 +0200
committerMichael Long <mchobbylong@gmail.com>2019-08-13 21:22:16 +0200
commit1f90f7b985214319b1363d0fa2b497d2a1cd9a8d (patch)
tree431c8ed6ff6019cb93bd50d72b40fcc35baf5c11
parent8535d803b8feb252c6f4a14b5e87a47111f1d4a8 (diff)
Use version_compare to avoid method checks
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index 3323ca6cf..66a28ffdc 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -453,7 +453,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
*/
protected function _expire_key($key, $ttl)
{
- if (method_exists($this->_redis, 'expire'))
+ if (version_compare(phpversion('redis'), '5', '>='))
return $this->_redis->expire($key, $ttl);
return $this->_redis->setTimeout($key, $ttl);
}
@@ -470,7 +470,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
*/
protected function _delete_key($key)
{
- if (method_exists($this->_redis, 'del'))
+ if (version_compare(phpversion('redis'), '5', '>='))
return $this->_redis->del($key);
return $this->_redis->delete($key);
}