From ee5bd73211ec20f7f8254bfb357896e2766f36c0 Mon Sep 17 00:00:00 2001 From: Bastien Jaillot Date: Tue, 12 Mar 2024 14:21:55 +0100 Subject: [PATCH] [Lock] compatiblity with redis cluster 7 --- src/Symfony/Component/Lock/Store/RedisStore.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Lock/Store/RedisStore.php b/src/Symfony/Component/Lock/Store/RedisStore.php index 0060f12a6bfdc..2baf322af065a 100644 --- a/src/Symfony/Component/Lock/Store/RedisStore.php +++ b/src/Symfony/Component/Lock/Store/RedisStore.php @@ -258,10 +258,10 @@ public function exists(Key $key) private function evaluate(string $script, string $resource, array $args) { if ( - $this->redis instanceof \Redis || - $this->redis instanceof \RedisCluster || - $this->redis instanceof RedisProxy || - $this->redis instanceof RedisClusterProxy + $this->redis instanceof \Redis + || $this->redis instanceof \RedisCluster + || $this->redis instanceof RedisProxy + || $this->redis instanceof RedisClusterProxy ) { $this->redis->clearLastError(); $result = $this->redis->eval($script, array_merge([$resource], $args), 1); @@ -317,7 +317,9 @@ private function getNowCode(): string try { $this->supportTime = 1 === $this->evaluate($script, 'symfony_check_support_time', []); } catch (LockStorageException $e) { - if (false === strpos($e->getMessage(), 'commands not allowed after non deterministic')) { + if (!str_contains($e->getMessage(), 'commands not allowed after non deterministic') + && !str_contains($e->getMessage(), 'is not allowed from script script') + ) { throw $e; } $this->supportTime = false;