8000 bug #37624 [Cache] Connect to RedisCluster with password auth (mforbak) · symfony/symfony@ebc7f4b · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit ebc7f4b

Browse files
bug #37624 [Cache] Connect to RedisCluster with password auth (mforbak)
This PR was submitted for the master branch but it was merged into the 4.4 branch instead. Discussion ---------- [Cache] Connect to RedisCluster with password auth | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Currently it is not possible to connect to RedisCluster with password. AUTH param is described in documentation (last example) https://symfony.com/doc/current/components/cache/adapters/redis_adapter.html#configure-the-connection but totally ignored in the code and connection fails ``` RedisAdapter::createConnection( 'redis:?host[localhost]&host[localhost:6379]&host[/var/run/redis.sock:]&auth=my-password&redis_cluster=1' ); ``` See RedisCluster usage here https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#declaring-a-cluster-with-an-array-of-seeds Commits ------- e873ddd Connect to RedisCluster with password auth
2 parents c971a27 + e873ddd commit ebc7f4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public static function createConnection($dsn, array $options = [])
228228
}
229229

230230
try {
231-
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent']);
231+
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent'], $params['auth'] ?? '');
232232
} catch (\RedisClusterException $e) {
233233
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e->getMessage());
234234
}

0 commit comments

Comments
 (0)
0