8000 Update RedisTrait.php · symfony/cache@d3f7680 · GitHub
[go: up one dir, main page]

Skip to content

Commit d3f7680

Browse files
evgkordnicolas-grekas
authored andcommitted
Update RedisTrait.php
[Cache] RedisTrait::createConnection does not pass auth value from redis sentinel cluster DSN
1 parent 93921d8 commit d3f7680

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Traits/RedisTrait.php

Lines changed: 5 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'], ...\defined('Redis::OPT_NULL_MULTIBULK_AS_NULL') ? [$params['auth'] ?? ''] : []);
211211

212212
if ($address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) {
213213
[$host, $port] = $address;
@@ -219,7 +219,10 @@ 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}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [[
223+
'auth' => $params['auth'] ?? '',
224+
'stream' => $params['ssl'] ?? null,
225+
]] : []);
223226

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

0 commit comments

Comments
 (0)
0