-
-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Labels
Milestone
Description
In the Factories parseUrl method, you are generating the auth param by combining the username and password. Redis as far as I am aware has no concept of users. A lot of connection strings just specify one because otherwise the password won't be parsed correctly by most tools. Ex: redis://anything:password@host:port.
It is an easy fix:
$auth = null;
if (isset($parts['user'])) {
$auth = $parts['user'];
}
if (isset($parts['pass'])) {
$auth .= ':' . $parts['pass'];
}
if ($auth !== null) {
$parts['auth'] = $auth;
}
change to
if (isset($parts['pass'])) {
$parts['auth'] = $parts['pass'];
}
I also am going to mention that redis:// is also a valid schema:
if ($parts === false || !isset($parts['host']) || $parts['scheme'] !== 'tcp') {
throw new InvalidArgumentException('Given URL can not be parsed');
}
changes to
$validSchemes = array('redis', 'tcp');
if ($parts === false || !isset($parts['host']) || !in_array($parts['scheme'], $validSchemes)) {
throw new InvalidArgumentException('Given URL can not be parsed');
}