8000 [Cache] RedisAdapter::createConnection - RedisCluster context · Issue #53597 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Cache] RedisAdapter::createConnection - RedisCluster context #53597
Closed
@vencakrecl

Description

@vencakrecl

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0