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

Commit 7020f26

Browse filesBrowse files
committed
bug #33797 [Cache] Fixed Redis Sentinel usage when only one Sentinel specified (Rohaq)
This PR was merged into the 4.4 branch. Discussion ---------- [Cache] Fixed Redis Sentinel usage when only one Sentinel specified 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. | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #33796 | License | MIT | Doc PR | As from Issue #33796 In a Redis Sentinel setup, if only a single Redis Sentinel, or multiple Sentinels with the same host/port are specified (as we're currently doing in a test environment), then the call to `setSentinelTimeout` in `RedisTrait.php` throws an exception, as the wrong interface appears to be initialised as a result. Adding a check for the `redis_sentinel` parameter, as was done with a check for the `redis_cluster` parameter, avoids this, and the Redis Client is initialised correctly. Commits ------- 13233fc Fixed Redis Sentinel usage when only one Sentinel specified
2 parents 526fd9f + 13233fc commit 7020f26
Copy full SHA for 7020f26

File tree

1 file changed

+1
-1
lines changed
Filter options

1 file changed

+1
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public static function createConnection($dsn, array $options = [])
271271
if (null !== $auth) {
272272
$params['parameters']['password'] = $auth;
273273
}
274-
if (1 === \count($hosts) && !$params['redis_cluster']) {
274+
if (1 === \count($hosts) && !($params['redis_cluster'] || $params['redis_sentinel'])) {
275275
$hosts = $hosts[0];
276276
} elseif (\in_array($params['failover'], ['slaves', 'distribute'], true) && !isset($params['replication'])) {
277277
$params['replication'] = true;

0 commit comments

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