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 1b0aed0

Browse filesBrowse files
bug #51775 [Cache] Fix two initializations of Redis Sentinel (digilist)
This PR was merged into the 6.4 branch. Discussion ---------- [Cache] Fix two initializations of Redis Sentinel | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT After #51687 and #51683 have been merged, there are now two initializations of Redis Sentinel, which also leads to the integration test failure mentioned in [this comment](#51687 (comment)). This PR fixes this. Commits ------- 2d23a1b [Cache] Fix two initializations of Redis Sentinel
2 parents 3c4cfbd + 2d23a1b commit 1b0aed0
Copy full SHA for 1b0aed0

File tree

1 file changed

+20
-21
lines changed
Filter options

1 file changed

+20
-21
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+20-21Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -223,29 +223,28 @@ public static function createConnection(#[\SensitiveParameter] string $dsn, arra
223223
break;
224224
}
225225

226-
if (version_compare(phpversion('redis'), '6.0.0', '>=') && $isRedisExt) {
227-
$options = [
228-
'host' => $host,
229-
'port' => $port,
230-
'connectTimeout' => $params['timeout'],
231-
'persistent' => $params['persistent_id'],
232-
'retryInterval' => $params['retry_interval'],
233-
'readTimeout' => $params['read_timeout'],
234-
];
235-
236-
if ($passAuth) {
237-
$options['auth'] = $params['auth'];
226+
try {
227+
if (version_compare(phpversion('redis'), '6.0.0', '>=') && $isRedisExt) {
228+
$options = [
229+
'host' => $host,
230+
'port' => $port,
231+
'connectTimeout' => $params['timeout'],
232+
'persistent' => $params['persistent_id'],
233+
'retryInterval' => $params['retry_interval'],
234+
'readTimeout' => $params['read_timeout'],
235+
];
236+
237+
if ($passAuth) {
238+
$options['auth'] = $params['auth'];
239+
}
240+
241+
$sentinel = new \RedisSentinel($options);
242+
} else {
243+
$extra = $passAuth ? [$params['auth']] : [];
244+
245+
$sentinel = new $sentinelClass($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...$extra);
238246
}
239247

240-
$sentinel = new \RedisSentinel($options);
241-
} else {
242-
$extra = $passAuth ? [$params['auth']] : [];
243-
244-
$sentinel = new $sentinelClass($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...$extra);
245-
}
246-
247-
try {
248-
$sentinel = new $sentinelClass($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...$extra);
249248
if ($address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) {
250249
[$host, $port] = $address;
251250
}

0 commit comments

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