Skip to content

Commit e8bcf5f

Browse files
Fix $auth check in RedisTrait
1 parent c066c3c commit e8bcf5f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public static function createConnection($dsn, array $options = [])
182182
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$error.'.');
183183
}
184184

185-
if ($auth && !$redis->auth($auth))
185+
if (($auth && !$redis->auth($auth))
186186
|| ($params['dbindex'] && !$redis->select($params['dbindex']))
187187
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
188188
) {

src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(array $configuration, array $connectionCredentials =
5656
$this->connection->setOption(\Redis::OPT_SERIALIZER, $redisOptions['serializer'] ?? \Redis::SERIALIZER_PHP);
5757

5858
$auth = $connectionCredentials['auth'] ?? null;
59-
if (!$auth && !$this->connection->auth($auth)) {
59+
if ($auth && !$this->connection->auth($auth)) {
6060
throw new InvalidArgumentException('Redis connection failed: '.$redis->getLastError());
6161
}
6262

0 commit comments

Comments
 (0)