Closed
Description
Symfony version(s) affected
7.0.2
Description
The context values verify_peer and verify_peer_name must contain the boolean value. I don't know why there is the condition ...\defined('Redis::SCAN_PREFIX') ? [$params['ssl'] ?? null] : []
in the last parameter, for me does not make any sense.
How to reproduce
RedisAdapter::createConnection('rediss://redis:6379?ssl[verify_peer]=false&ssl[verify_peer_name]=false&redis_cluster=true&auth[user]=root&auth[pass]=root')
Possible Solution
trait RedisTrait
{
...
$context = [];
foreach ($params['ssl'] ?? [] as $key => $value) {
if(in_array($value, ['true', 'false'])) {
$context[$key] = $value === "true" ? true : false;
}else {
$context[$key];
}
}
try {
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent'], $params['auth'] ?? '', $context);
} catch (\RedisClusterException $e) {
throw new InvalidArgumentException('Redis connection failed: '.$e->getMessage());
}
...
}
Additional Context
No response