From 2dbb72833acaa06d3657962e072be188e472aeb0 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 12 May 2026 15:50:41 +0100 Subject: [PATCH] fix: throw InvalidArgumentException for non-positive timeouts Previously readTimeout <= 0 was silently coerced to 0.25s. Better to fail loudly so misconfiguration surfaces during testing rather than masking the user's intent at runtime. Apply the same rule to the connect timeout. Co-Authored-By: Claude Opus 4.7 --- src/Cache/Adapter/Redis/Multiplexing.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Cache/Adapter/Redis/Multiplexing.php b/src/Cache/Adapter/Redis/Multiplexing.php index 52a17d0c30..fcb9d9956c 100644 --- a/src/Cache/Adapter/Redis/Multiplexing.php +++ b/src/Cache/Adapter/Redis/Multiplexing.php @@ -56,8 +56,11 @@ class Multiplexing implements Adapter, TelemetryFeature private string|array|null $auth = null, private int $dbIndex = 0, ) { + if ($this->timeout <= 0) { + throw new \InvalidArgumentException('timeout must be greater than 0'); + } if ($this->readTimeout <= 0) { - $this->readTimeout = 0.25; + throw new \InvalidArgumentException('readTimeout must be greater than 0'); } $this->sendLock = new Lock(); $this->setTelemetry(new NoTelemetry());