From c38a18569bbb106a56cc72bf2bf03f52c2a0fc2f Mon Sep 17 00:00:00 2001 From: Vitaliy Lyubimov Date: Mon, 21 Oct 2024 18:25:38 +0200 Subject: [PATCH 1/2] Fixed the auth with username and password --- src/Factory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Factory.php b/src/Factory.php index 1493057..5dea406 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -106,7 +106,11 @@ public function createClient($uri) if (isset($args['password']) || isset($parts['pass'])) { $pass = isset($args['password']) ? $args['password'] : rawurldecode($parts['pass']); $promise = $promise->then(function (StreamingClient $redis) use ($pass, $uri) { - return $redis->auth($pass)->then( + $promise = empty($args['username']) + ? $redis->auth($pass) + : $redis->auth($args['username'], $pass); + + return $promise->then( function () use ($redis) { return $redis; }, From 9a14059756d2aa535b96bfbf1d7f42bf52b2f9d4 Mon Sep 17 00:00:00 2001 From: Vitaliy Lyubimov Date: Mon, 21 Oct 2024 18:33:35 +0200 Subject: [PATCH 2/2] Added missed use on connection callback --- src/Factory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Factory.php b/src/Factory.php index 5dea406..1a74c3b 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -105,7 +105,7 @@ public function createClient($uri) $pass = isset($args['password']) ? $args['password'] : (isset($parts['pass']) ? rawurldecode($parts['pass']) : null); if (isset($args['password']) || isset($parts['pass'])) { $pass = isset($args['password']) ? $args['password'] : rawurldecode($parts['pass']); - $promise = $promise->then(function (StreamingClient $redis) use ($pass, $uri) { + $promise = $promise->then(function (StreamingClient $redis) use ($pass, $uri, $args) { $promise = empty($args['username']) ? $redis->auth($pass) : $redis->auth($args['username'], $pass);