Skip to content

Commit 169d8e4

Browse files
authored
Merge pull request #9 from PromPHP/always-cast-redis-port-and-timeout
Always cast redis port and timeout to the correct value types
2 parents d5e9c36 + 4c898dc commit 169d8e4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Prometheus/Storage/Redis.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ private function connectToServer(): void
150150
if ($this->options['persistent_connections']) {
151151
$connection_successful = $this->redis->pconnect(
152152
$this->options['host'],
153-
$this->options['port'],
154-
$this->options['timeout']
153+
(int) $this->options['port'],
154+
(float) $this->options['timeout']
155155
);
156156
} else {
157-
$connection_successful = $this->redis->connect($this->options['host'], $this->options['port'], $this->options['timeout']);
157+
$connection_successful = $this->redis->connect($this->options['host'], (int) $this->options['port'], (float) $this->options['timeout']);
158158
}
159159
if (!$connection_successful) {
160160
throw new StorageException("Can't connect to Redis server", 0);

0 commit comments

Comments
 (0)