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 51bbdc8

Browse filesBrowse files
committed
bug #48816 [Cache] Fix for RedisAdapter without auth parameter (rikvdh)
This PR was merged into the 5.4 branch. Discussion ---------- [Cache] Fix for RedisAdapter without auth parameter | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #48813 | License | MIT | Doc PR | x Compatibility with Redis without auth was broken by #48711, this change fixes this. This applies for all versions (6.x as well). Commits ------- 0cf91ab fix for caching without auth parameter, broken by #48711, fix for #48813
2 parents 3502d7e + 0cf91ab commit 51bbdc8
Copy full SHA for 51bbdc8

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.