Skip to content

Commit 61b3b46

Browse files
authored
Update RedisTrait.php
[Cache] RedisTrait::createConnection does not pass auth value from redis sentinel cluster DSN
1 parent 27a9df3 commit 61b3b46

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public static function createConnection(string $dsn, array $options = [])
207207
break;
208208
}
209209

210-
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']);
210+
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], $params['auth'] ?? null);
211211

212212
if ($address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) {
213213
[$host, $port] = $address;
@@ -219,7 +219,18 @@ public static function createConnection(string $dsn, array $options = [])
219219
}
220220

221221
try {
222-
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [['stream' => $params['ssl'] ?? null]] : []);
222+
@$redis->{$connect}(
223+
$host,
224+
$port,
225+
$params['timeout'],
226+
(string) $params['persistent_id'],
227+
$params['retry_interval'],
228+
$params['read_timeout'],
229+
array_merge(
230+
isset($params['auth']) ? ['auth' => $params['auth']] : [],
231+
\defined('Redis::SCAN_PREFIX') ? ['stream' => $params['ssl'] ?? null] : []
232+
)
233+
);
223234

224235
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
225236
try {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy