Skip to content

Commit 4eb8013

Browse files
bug symfony#48711 [Cache] RedisTrait::createConnection does not pass auth value from redis sentinel cluster DSN (evgkord)
This PR was merged into the 5.4 branch. Discussion ---------- [Cache] RedisTrait::createConnection does not pass auth value from redis sentinel cluster DSN [Cache] RedisTrait::createConnection does not pass auth value from redis sentinel cluster DSN | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no - bugfix | Deprecations? | no | Tickets | Fix symfony#48712 | License | MIT | Doc PR | none - bugfix <!-- Replace this notice by a short README for your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Commits ------- 26ba375 Update RedisTrait.php
2 parents 4362f6e + 26ba375 commit 4eb8013

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Symfony/Component/Cache/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)