Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Cache] RedisTrait::createConnection does not pass auth value from redis sentinel cluster DSN #48712

Copy link
Copy link
Closed
@evgkord

Description

@evgkord
Issue body actions

Symfony version(s) affected

5.4

Description

When redis sentinel cluster with non-empty auth phrase used, we may pass it in DSN as described. However, param "auth" stay ignored and not passes properly while RedisTrait::createConnection.

How to reproduce

  1. Ensure the redis php extension is installed
  2. Create a redis connection with multiple sentinel hosts and non-empty auth phrase: RedisAdapter::createConnection('redis:?host[sentinel1:26379]&host[sentinel2:26379]&host[sentinel3:26379]&redis_sentinel=mysentinel&auth=myauth')

Expected Behaviour
An instance of \Redis should be returned with a connection to the current redis master assigned by redis sentinel

Current Behaviour
After \RedisSentinel instance created without auth phrase, calling method ::getMasterAddrByName() is unable to get adress of master in cluster and it causes \Symfony\Component\Cache\Exception\InvalidArgumentException with message 'Failed to retrieve master information from sentinel "mysentinel" and dsn "redis:?host[sentinel1:26379]&host[sentinel2:26379]&host[sentinel3:26379]&redis_sentinel=mysentinel&auth=myauth".'

Possible Solution

phpredis extension supports passing auth as argument of \RedisSentinel::__consruct(), so it probably should be passed if it present in DSN.

also param auth should be passed in such trait while \Redis::connect(), as described to avoid RedisException: NOAUTH Authentication required, for example when you later want some $redis->eval(...),

Additional Context

PR 48711

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.