Skip to content

Commit 1ed9078

Browse files
committed
Fix FLOAT error when TIMEOUT is null on Redis 6.x
1 parent b30b74f commit 1ed9078

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

system/libraries/Cache/drivers/Cache_redis.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ class CI_Cache_redis extends CI_Driver
6060
'host' => '127.0.0.1',
6161
'password' => NULL,
6262
'port' => 6379,
63-
'timeout' => 0
63+
'timeout' => 0.0,
64+
'database' => 0
6465
);
6566

6667
/**

system/libraries/Session/drivers/Session_redis_driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function __construct(&$params)
157157
{
158158
$save_path['password'] = preg_match('#auth=([^\s&]+)#', $matches['options'], $match) ? $match[1] : NULL;
159159
$save_path['database'] = preg_match('#database=(\d+)#', $matches['options'], $match) ? (int) $match[1] : NULL;
160-
$save_path['timeout'] = preg_match('#timeout=(\d+\.\d+)#', $matches['options'], $match) ? (float) $match[1] : NULL;
160+
$save_path['timeout'] = preg_match('#timeout=(\d+\.\d+)#', $matches['options'], $match) ? (float) $match[1] : 0.0;
161161

162162
preg_match('#prefix=([^\s&]+)#', $matches['options'], $match) && $this->_key_prefix = $match[1];
163163
}

0 commit comments

Comments
 (0)