8000 bug #23045 [Cache] fix Redis scheme detection (xabbuh) · symfony/symfony@7078cdf · GitHub
[go: up one dir, main page]

Skip to content

Commit 7078cdf

Browse files
bug #23045 [Cache] fix Redis scheme detection (xabbuh)
This PR was merged into the 3.2 branch. Discussion ---------- [Cache] fix Redis scheme detection | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #22974 | License | MIT | Doc PR | Commits ------- 61685c7 [Cache] fix Redis scheme detection
2 parents 3e92637 + 61685c7 commit 7078cdf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Symfony/Component/Cache/Adapter/RedisAdapter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ public static function createConnection($dsn, array $options = array())
9090
$params['dbindex'] = $m[1];
9191
$params['path'] = substr($params['path'], 0, -strlen($m[0]));
9292
}
93+
if (isset($params['host'])) {
94+
$scheme = 'tcp';
95+
} else {
96+
$scheme = 'unix';
97+
}
9398
$params += array(
9499
'host' => isset($params['host']) ? $params['host'] : $params['path'],
95100
'port' => isset($params['host']) ? 6379 : null,
@@ -120,7 +125,7 @@ public static function createConnection($dsn, array $options = array())
120125
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e, $dsn));
121126
}
122127
} elseif (is_a($class, \Predis\Client::class, true)) {
123-
$params['scheme'] = isset($params['host']) ? 'tcp' : 'unix';
128+
$params['scheme'] = $scheme;
124129
$params['database'] = $params['dbindex'] ?: null;
125130
$params['password'] = $auth;
126131
$redis = new $class((new Factory())->create($params));

0 commit comments

Comments
 (0)
0