From 5882c4169d28369c9833ef226a9eae71e63c4516 Mon Sep 17 00:00:00 2001 From: igor Date: Tue, 9 Aug 2022 10:16:22 +0300 Subject: [PATCH 1/2] To clean up TimeOut`s #174 --- src/Client.php | 7 +++++-- src/Settings.php | 4 ++-- src/Transport/CurlerRequest.php | 3 ++- src/Transport/Http.php | 4 ++-- tests/FormatQueryTest.php | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Client.php b/src/Client.php index a9a7cf2..b9121e7 100644 --- a/src/Client.php +++ b/src/Client.php @@ -189,9 +189,12 @@ public function setTimeout(int $timeout) } /** - * @return float + * Return max_execution_time in Second `int` + * M(Seconds, max_execution_time, 0, "", 0) in /src/Core/Settings.h#L52 + * + * @return int */ - public function getTimeout(): float + public function getTimeout(): int { return $this->settings()->getTimeOut(); } diff --git a/src/Settings.php b/src/Settings.php index 73ae4d0..d4e770d 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -93,9 +93,9 @@ public function database($db) } /** - * @return float + * @return int */ - public function getTimeOut(): float + public function getTimeOut(): int { return $this->get('max_execution_time'); } diff --git a/src/Transport/CurlerRequest.php b/src/Transport/CurlerRequest.php index ad1c5fc..79bdd9f 100644 --- a/src/Transport/CurlerRequest.php +++ b/src/Transport/CurlerRequest.php @@ -118,7 +118,7 @@ public function __construct($id = false) CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => 10, - CURLOPT_CONNECTTIMEOUT => 5, // Количество секунд ожидания при попытке соединения + // CURLOPT_CONNECTTIMEOUT => 5, // Количество секунд ожидания при попытке соединения CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_MAXREDIRS => 10, CURLOPT_HEADER => TRUE, @@ -487,6 +487,7 @@ public function parameters($data) /** * The number of seconds to wait when trying to connect. Use 0 for infinite waiting. + * CURLOPT_CONNECTTIMEOUT_MS * * @param float $seconds * @return $this diff --git a/src/Transport/Http.php b/src/Transport/Http.php index 2aa525e..0d922d8 100644 --- a/src/Transport/Http.php +++ b/src/Transport/Http.php @@ -411,7 +411,7 @@ public function getCountPendingQueue(): int } /** - * set Connect TimeOut in seconds [CURLOPT_CONNECTTIMEOUT] ( int ) + * set Connect TimeOut in seconds [CURLOPT_CONNECTTIMEOUT_MS] ( float ) ($seconds*1000.0) * * @param float $connectTimeOut */ @@ -421,7 +421,7 @@ public function setConnectTimeOut(float $connectTimeOut) } /** - * get ConnectTimeOut in seconds + * get ConnectTimeOut in seconds, CURLOPT_CONNECTTIMEOUT_MS * * @return int */ diff --git a/tests/FormatQueryTest.php b/tests/FormatQueryTest.php index 9e07651..441abde 100644 --- a/tests/FormatQueryTest.php +++ b/tests/FormatQueryTest.php @@ -69,9 +69,9 @@ public function testClientTimeoutSettings() $this->assertSame(intval($timeout), $this->client->getTimeout()); $timeout = 5.14; - $this->client->setConnectTimeOut($timeout); // 5 seconds + $this->client->setConnectTimeOut($timeout); // 5,14 seconds $this->client->select('SELECT 123,123 as ping ')->rows(); - $this->assertSame(5, $this->client->getConnectTimeOut()); + $this->assertSame(5.14, $this->client->getConnectTimeOut()); } From dc88581eaa65a20bfc13906b59a4a24720ea4f17 Mon Sep 17 00:00:00 2001 From: moknomo Date: Tue, 20 Dec 2022 12:58:19 +0300 Subject: [PATCH 2/2] add mbstring to composer require --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 24d905c..8c41358 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "require": { "php": "^7.3|^8.0", "ext-curl": "*", - "ext-json": "*" + "ext-json": "*", + "ext-mbstring": "*" }, "require-dev": { "doctrine/coding-standard": "^8.2",