From 5a2995ca8870fad694d6b0cbcb448a161ef71904 Mon Sep 17 00:00:00 2001 From: "Sergey.Klimov" Date: Fri, 11 Jan 2019 19:40:09 +0300 Subject: [PATCH 1/4] 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 1dac31df3..3ee5f28a3 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 bd235583f..b76afd7c3 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/4] 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 3ee5f28a3..3ea492078 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 b76afd7c3..7917bd07f 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/4] 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 3ea492078..a0f8a5364 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 7917bd07f..a56cfaa0a 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) From 470621b1b49e8507324f65f7e4a64f014515b3d3 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 22 Jan 2019 13:48:39 -0600 Subject: [PATCH 4/4] Adds CHANGELOG entry for #168 --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd6a0e22d..4f35181a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. -## 2.9.1 - TBD +## 2.9.1 - 2019-01-22 ### Added @@ -22,7 +22,9 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- Nothing. +- [#168](https://github.com/zendframework/zend-http/pull/168) fixes a problem when validating the connection timeout for the `Curl` and + `Socket` client adapters; it now correctly identifies both integer and string + integer values. ## 2.9.0 - 2019-01-08