-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
Description
Symfony version(s) affected
6.0.*
Description
When we use a default_redis_provider
with password
Like rediss://<user>:<pass>@<host>:<port>/<path>
The RedisTrait
initializer will failed with a WRONGPASS because at line 214 the $redis->auth($auth)
is only called with password instead of user and password
How to reproduce
See Description
Possible Solution
Change line 97
$params = preg_replace_callback('#^'.$scheme.':(//)?(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) {
if (isset($m[2])) {
$auth = $m[2];
if ('' === $auth) {
$auth = null;
}
}
return 'file:'.($m[1] ?? '');
}, $dsn);
BY
$params = preg_replace_callback('#^'.$scheme.':(\/\/)?([^:@]*+)(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) {
if (isset($m[2])) {
$auth = $m[2];
if ('' === $auth) {
$auth = null;
}
if (isset($m[3])) {
$auth = [ $auth, $m[3] ];
}
}
return 'file:'.($m[1] ?? '');
}, $dsn);
Additional Context
Warning the fix not working completly for other paths