From 5a2995ca8870fad694d6b0cbcb448a161ef71904 Mon Sep 17 00:00:00 2001 From: "Sergey.Klimov" Date: Fri, 11 Jan 2019 19:40:09 +0300 Subject: [PATCH 1/3] Fix for timeout config parameter validation --- src/Client/Adapter/Curl.php | 2 +- src/Client/Adapter/Socket.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client/Adapter/Curl.php b/src/Client/Adapter/Curl.php index 1dac31df3d..3ee5f28a3f 100644 --- a/src/Client/Adapter/Curl.php +++ b/src/Client/Adapter/Curl.php @@ -209,7 +209,7 @@ public function connect($host, $port = 80, $secure = false) $connectTimeout = null; } - if ($connectTimeout !== null && (! is_int($connectTimeout) || ! is_numeric($connectTimeout))) { + if ($connectTimeout !== null && !is_int($connectTimeout) && !is_numeric($connectTimeout)) { throw new AdapterException\InvalidArgumentException(sprintf( 'integer or numeric string expected, got %s', gettype($connectTimeout) diff --git a/src/Client/Adapter/Socket.php b/src/Client/Adapter/Socket.php index bd235583ff..b76afd7c32 100644 --- a/src/Client/Adapter/Socket.php +++ b/src/Client/Adapter/Socket.php @@ -263,7 +263,7 @@ public function connect($host, $port = 80, $secure = false) $connectTimeout = $this->config['timeout']; } - if ($connectTimeout !== null && (! is_int($connectTimeout) || ! is_numeric($connectTimeout))) { + if ($connectTimeout !== null && !is_int($connectTimeout) && !is_numeric($connectTimeout)) { throw new AdapterException\InvalidArgumentException(sprintf( 'integer or numeric string expected, got %s', gettype($connectTimeout) From 1c9f2491c88c9a8a3677ed60e6ef8c13d99ff4b6 Mon Sep 17 00:00:00 2001 From: "Sergey.Klimov" Date: Fri, 11 Jan 2019 20:29:37 +0300 Subject: [PATCH 2/3] Code style fix --- src/Client/Adapter/Curl.php | 2 +- src/Client/Adapter/Socket.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client/Adapter/Curl.php b/src/Client/Adapter/Curl.php index 3ee5f28a3f..3ea4920780 100644 --- a/src/Client/Adapter/Curl.php +++ b/src/Client/Adapter/Curl.php @@ -209,7 +209,7 @@ public function connect($host, $port = 80, $secure = false) $connectTimeout = null; } - if ($connectTimeout !== null && !is_int($connectTimeout) && !is_numeric($connectTimeout)) { + if ($connectTimeout !== null && ! is_int($connectTimeout) && ! is_numeric($connectTimeout)) { throw new AdapterException\InvalidArgumentException(sprintf( 'integer or numeric string expected, got %s', gettype($connectTimeout) diff --git a/src/Client/Adapter/Socket.php b/src/Client/Adapter/Socket.php index b76afd7c32..7917bd07ff 100644 --- a/src/Client/Adapter/Socket.php +++ b/src/Client/Adapter/Socket.php @@ -263,7 +263,7 @@ public function connect($host, $port = 80, $secure = false) $connectTimeout = $this->config['timeout']; } - if ($connectTimeout !== null && !is_int($connectTimeout) && !is_numeric($connectTimeout)) { + if ($connectTimeout !== null && ! is_int($connectTimeout) && ! is_numeric($connectTimeout)) { throw new AdapterException\InvalidArgumentException(sprintf( 'integer or numeric string expected, got %s', gettype($connectTimeout) From a734185344c5c77011272e99b978d139b92605c3 Mon Sep 17 00:00:00 2001 From: "Sergey.Klimov" Date: Mon, 14 Jan 2019 19:14:15 +0300 Subject: [PATCH 3/3] Cleaning --- src/Client/Adapter/Curl.php | 2 +- src/Client/Adapter/Socket.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client/Adapter/Curl.php b/src/Client/Adapter/Curl.php index 3ea4920780..a0f8a53646 100644 --- a/src/Client/Adapter/Curl.php +++ b/src/Client/Adapter/Curl.php @@ -209,7 +209,7 @@ public function connect($host, $port = 80, $secure = false) $connectTimeout = null; } - if ($connectTimeout !== null && ! is_int($connectTimeout) && ! is_numeric($connectTimeout)) { + if ($connectTimeout !== null && ! is_numeric($connectTimeout)) { throw new AdapterException\InvalidArgumentException(sprintf( 'integer or numeric string expected, got %s', gettype($connectTimeout) diff --git a/src/Client/Adapter/Socket.php b/src/Client/Adapter/Socket.php index 7917bd07ff..a56cfaa0a9 100644 --- a/src/Client/Adapter/Socket.php +++ b/src/Client/Adapter/Socket.php @@ -263,7 +263,7 @@ public function connect($host, $port = 80, $secure = false) $connectTimeout = $this->config['timeout']; } - if ($connectTimeout !== null && ! is_int($connectTimeout) && ! is_numeric($connectTimeout)) { + if ($connectTimeout !== null && ! is_numeric($connectTimeout)) { throw new AdapterException\InvalidArgumentException(sprintf( 'integer or numeric string expected, got %s', gettype($connectTimeout)