From e59a331110eacf2e87f8d886d63f750b3bbad869 Mon Sep 17 00:00:00 2001 From: Andrius Solopovas Date: Tue, 29 Aug 2023 21:40:40 +0100 Subject: [PATCH] Update PhpRedis.php Fixed PHP Deprecated: Redis::connect(): Passing null to parameter #5 of type int is deprecated in vendor/enqueue/redis/PhpRedis.php on line 119 --- pkg/redis/PhpRedis.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/redis/PhpRedis.php b/pkg/redis/PhpRedis.php index d6f5baffa..4cfb9ef87 100644 --- a/pkg/redis/PhpRedis.php +++ b/pkg/redis/PhpRedis.php @@ -109,15 +109,16 @@ public function connect(): void $host = $this->config['scheme'] === 'rediss' ? 'tls://' . $this->config['host'] : $this->config['host']; - $result = call_user_func( - [$this->redis, $connectionMethod], - 'unix' === $this->config['scheme'] ? $this->config['path'] : $host, - $this->config['port'], - $this->config['timeout'], - $this->config['persistent'] ? ($this->config['phpredis_persistent_id'] ?? null) : null, - $this->config['phpredis_retry_interval'] ?? null, - $this->config['read_write_timeout'] - ); + $args = [ + 'unix' === $this->config['scheme'] ? $this->config['path'] : $host, + $this->config['port'], + $this->config['timeout'], + $this->config['persistent'] ? ($this->config['phpredis_persistent_id'] ?? null) : null, + $this->config['phpredis_retry_interval'] ?? null, + $this->config['read_write_timeout'] ?? null, + ]; + + $result = $this->redis->$connectionMethod(...array_filter($args, fn ($arg) => isset($arg))); if (false == $result) { throw new ServerException('Failed to connect.');