bug #41099 [Cache] Check if phpredis version is compatible with stream parameter (nicolassing)
This PR was merged into the 4.4 branch.
Discussion
----------
[Cache] Check if phpredis version is compatible with stream parameter
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
If you use phpredis <5.3.0, you can't connect to Redis since symfony/cache 5.2.7
Fixes #41110
Commits
-------
841d85a7ce
Check redis extension version
This commit is contained in:
commit
ae38bda5c2
|
@ -188,7 +188,7 @@ trait RedisTrait
|
|||
}
|
||||
|
||||
try {
|
||||
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ['stream' => $params['ssl'] ?? null]);
|
||||
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [['stream' => $params['ssl'] ?? null]] : []);
|
||||
|
||||
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
||||
$isConnected = $redis->isConnected();
|
||||
|
@ -251,7 +251,7 @@ trait RedisTrait
|
|||
}
|
||||
|
||||
try {
|
||||
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent'], $params['auth'] ?? '', $params['ssl'] ?? null);
|
||||
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent'], $params['auth'] ?? '', ...\defined('Redis::SCAN_PREFIX') ? [$params['ssl'] ?? null] : []);
|
||||
} catch (\RedisClusterException $e) {
|
||||
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e->getMessage());
|
||||
}
|
||||
|
|
Reference in New Issue