From fa7ca6e1901f899f765cc3bf270c0663689ff409 Mon Sep 17 00:00:00 2001 From: breken Date: Wed, 9 Sep 2026 17:10:27 -0700 Subject: [PATCH] fix(queue): authenticate Redis 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). Null/empty-string checks keep the guard from treating valid edge-case credentials like "0" as unconfigured. An auth failure throws RedisException inside the existing connect retry loop, so misconfiguration fails loudly with bounded retries. --- packages/queue/src/Queue/Connection/Redis.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/queue/src/Queue/Connection/Redis.php b/packages/queue/src/Queue/Connection/Redis.php index 5f15dfd13..a5726fcfb 100644 --- a/packages/queue/src/Queue/Connection/Redis.php +++ b/packages/queue/src/Queue/Connection/Redis.php @@ -202,6 +202,12 @@ protected function getRedis(): \Redis try { $redis->connect($this->host, $this->port, $connectTimeout); + if ($this->password !== null && $this->password !== '') { + // ACL form when a username is configured, plain password otherwise. + $hasUser = $this->user !== null && $this->user !== ''; + $redis->auth($hasUser ? [$this->user, $this->password] : $this->password); + } + if ($this->readTimeout >= 0) { $redis->setOption(\Redis::OPT_READ_TIMEOUT, $this->readTimeout); }