From 852c5efa56450f6c570a259313f50764ac57eb91 Mon Sep 17 00:00:00 2001 From: breken Date: Wed, 9 Sep 2026 16:48:48 -0700 Subject: [PATCH] fix(redis): authenticate connection when user/password are configured The constructor accepts ?user/?password but getRedis() never called auth(), so every operation against a password-protected Redis failed with NOAUTH. Authenticate right after connect, using the ACL array form [user, password] when a username is set and the plain password form otherwise (phpredis >= 5.3). An auth failure throws RedisException inside the existing connect retry loop, so misconfiguration fails loudly with bounded retries instead of silently retrying unauthenticated operations. --- src/Queue/Connection/Redis.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Queue/Connection/Redis.php b/src/Queue/Connection/Redis.php index 5f15dfd..d3230f6 100644 --- a/src/Queue/Connection/Redis.php +++ b/src/Queue/Connection/Redis.php @@ -202,6 +202,11 @@ protected function getRedis(): \Redis try { $redis->connect($this->host, $this->port, $connectTimeout); + if (!empty($this->password)) { + // ACL form when a username is configured, plain password otherwise. + $redis->auth(!empty($this->user) ? [$this->user, $this->password] : $this->password); + } + if ($this->readTimeout >= 0) { $redis->setOption(\Redis::OPT_READ_TIMEOUT, $this->readTimeout); }