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 0cf91ab

Browse filesBrowse files
committed
fix for caching without auth parameter, broken by #48711, fix for #48813
1 parent 3502d7e commit 0cf91ab
Copy full SHA for 0cf91ab

File tree

1 file changed

+11
-5
lines changed
Filter options

1 file changed

+11
-5
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+11-5Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,11 @@ public static function createConnection(string $dsn, array $options = [])
206206
if (!isset($params['redis_sentinel'])) {
207207
break;
208208
}
209-
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'] ?? ''] : []);
209+
$extra = [];
210+
if (\defined('Redis::OPT_NULL_MULTIBULK_AS_NULL') && isset($params['auth'])) {
211+
$extra = [$params['auth']];
212+
}
213+
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...$extra);
211214

212215
if ($address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) {
213216
[$host, $port] = $address;
@@ -219,10 +222,13 @@ public static function createConnection(string $dsn, array $options = [])
219222
}
220223

221224
try {
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'] ?? '',
225+
$extra = [
224226
'stream' => $params['ssl'] ?? null,
225-
]] : []);
227+
];
228+
if (isset($params['auth'])) {
229+
$extra['auth'] = $params['auth'];
230+
}
231+
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [$extra] : []);
226232

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

0 commit comments

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