Skip to content

Commit 841d85a

Browse files
nicolassingnicolas-grekas
authored andcommitted
Check redis extension version
1 parent c276f0d commit 841d85a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public static function createConnection($dsn, array $options = [])
188188
}
189189

190190
try {
191-
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ['stream' => $params['ssl'] ?? null]);
191+
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [['stream' => $params['ssl'] ?? null]] : []);
192192

193193
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
194194
$isConnected = $redis->isConnected();
@@ -251,7 +251,7 @@ public static function createConnection($dsn, array $options = [])
251251
}
252252

253253
try {
254-
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent'], $params['auth'] ?? '', $params['ssl'] ?? null);
254+
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent'], $params['auth'] ?? '', ...\defined('Redis::SCAN_PREFIX') ? [$params['ssl'] ?? null] : []);
255255
} catch (\RedisClusterException $e) {
256256
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e->getMessage());
257257
}

0 commit comments

Comments
 (0)