Skip to content

Commit

Permalink
Fixed Redis Sentinel usage when only one Sentinel specified
Browse files Browse the repository at this point in the history
Added check for $params['redis_sentinel'] to line 274, as by converting the array of hosts to a single host configuration (as you might in a test environment), this causes the class to initialise incorrectly.
  • Loading branch information
Rohaq committed Oct 1, 2019
1 parent 5b7848c commit 13233fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Traits/RedisTrait.php
Expand Up @@ -271,7 +271,7 @@ public static function createConnection($dsn, array $options = [])
if (null !== $auth) {
$params['parameters']['password'] = $auth;
}
if (1 === \count($hosts) && !$params['redis_cluster']) {
if (1 === \count($hosts) && !($params['redis_cluster'] || $params['redis_sentinel'])) {
$hosts = $hosts[0];
} elseif (\in_array($params['failover'], ['slaves', 'distribute'], true) && !isset($params['replication'])) {
$params['replication'] = true;
Expand Down

0 comments on commit 13233fc

Please sign in to comment.