From 377dd198175cd4257ea1278018e6e699b9dc3a07 Mon Sep 17 00:00:00 2001 From: walkor Date: Mon, 29 May 2023 22:42:38 +0800 Subject: [PATCH 1/7] Fix host() with ipv6 --- Protocols/Http/Request.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Protocols/Http/Request.php b/Protocols/Http/Request.php index e54855795..7567d4db4 100644 --- a/Protocols/Http/Request.php +++ b/Protocols/Http/Request.php @@ -208,8 +208,8 @@ public function protocolVersion() public function host($without_port = false) { $host = $this->header('host'); - if ($host && $without_port && $pos = \strpos($host, ':')) { - return \substr($host, 0, $pos); + if ($host && $without_port) { + return preg_replace('/:\d{1,5}$/', '', $host); } return $host; } From 29abb493240b59773d14daa4e31f9c0d3d8f2d88 Mon Sep 17 00:00:00 2001 From: walkor Date: Wed, 19 Jul 2023 19:10:31 +0800 Subject: [PATCH 2/7] Update Request.php --- Protocols/Http/Request.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Protocols/Http/Request.php b/Protocols/Http/Request.php index 7567d4db4..ea0a06369 100644 --- a/Protocols/Http/Request.php +++ b/Protocols/Http/Request.php @@ -71,6 +71,12 @@ class Request */ protected static $_enableCache = true; + /** + * Is safe. + * + * @var bool + */ + protected $_isSafe = true; /** * Request constructor. @@ -656,6 +662,15 @@ public function __toString() return $this->_buffer; } + /** + * __wakeup. + * @return void + */ + public function __wakeup() + { + $this->_isSafe = false; + } + /** * __destruct. * @@ -663,7 +678,7 @@ public function __toString() */ public function __destruct() { - if (isset($this->_data['files'])) { + if (isset($this->_data['files']) && $this->_isSafe) { \clearstatcache(); \array_walk_recursive($this->_data['files'], function($value, $key){ if ($key === 'tmp_name') { From a8d2becd4754c77a7216e15308e1716c4932d94e Mon Sep 17 00:00:00 2001 From: walkor Date: Wed, 19 Jul 2023 19:29:31 +0800 Subject: [PATCH 3/7] Update Session.php --- Protocols/Http/Session.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Protocols/Http/Session.php b/Protocols/Http/Session.php index b8323d37b..31673fc12 100644 --- a/Protocols/Http/Session.php +++ b/Protocols/Http/Session.php @@ -134,6 +134,13 @@ class Session */ protected $_sessionId = null; + /** + * Is safe. + * + * @var bool + */ + protected $_isSafe = true; + /** * Session constructor. * @@ -402,6 +409,15 @@ public function gc() static::$_handler->gc(static::$lifetime); } + /** + * __wakeup. + * @return void + */ + public function __wakeup() + { + $this->_isSafe = false; + } + /** * __destruct. * @@ -409,6 +425,9 @@ public function gc() */ public function __destruct() { + if (!$this->_isSafe) { + return; + } $this->save(); if (\rand(1, static::$gcProbability[1]) <= static::$gcProbability[0]) { $this->gc(); From 543e0d3b77c49641b065c493809c1467154ba186 Mon Sep 17 00:00:00 2001 From: walkor Date: Thu, 27 Jul 2023 15:39:29 +0800 Subject: [PATCH 4/7] Update Worker.php --- Worker.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Worker.php b/Worker.php index 36e3d837c..76136d985 100644 --- a/Worker.php +++ b/Worker.php @@ -34,7 +34,7 @@ class Worker * * @var string */ - const VERSION = '4.0.45'; + const VERSION = '4.0.46'; /** * Status starting. @@ -1057,7 +1057,10 @@ protected static function formatStatusData($statistics_file) } $status_str = ''; $current_total_request = array(); - $worker_info = \unserialize($info[0]); + $workerInfo = []; + try { + $workerInfo = unserialize($info[0], ['allowed_classes' => false]); + } catch (Throwable $exception) {} \ksort($worker_info, SORT_NUMERIC); unset($info[0]); $data_waiting_sort = array(); From 83cec1adb792567471dff82cbb53f6391cfcea45 Mon Sep 17 00:00:00 2001 From: walkor Date: Mon, 31 Jul 2023 14:02:34 +0800 Subject: [PATCH 5/7] Update Worker.php --- Worker.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Worker.php b/Worker.php index 76136d985..b5ed58c5d 100644 --- a/Worker.php +++ b/Worker.php @@ -1057,9 +1057,9 @@ protected static function formatStatusData($statistics_file) } $status_str = ''; $current_total_request = array(); - $workerInfo = []; + $worker_info = []; try { - $workerInfo = unserialize($info[0], ['allowed_classes' => false]); + $worker_info = unserialize($info[0], ['allowed_classes' => false]); } catch (Throwable $exception) {} \ksort($worker_info, SORT_NUMERIC); unset($info[0]); From 642db6d94701bcadabf63cc9452793a6baef3d5f Mon Sep 17 00:00:00 2001 From: walkor Date: Mon, 31 Jul 2023 14:06:27 +0800 Subject: [PATCH 6/7] Update Worker.php --- Worker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Worker.php b/Worker.php index b5ed58c5d..1a91c85dd 100644 --- a/Worker.php +++ b/Worker.php @@ -34,7 +34,7 @@ class Worker * * @var string */ - const VERSION = '4.0.46'; + const VERSION = '4.0.47'; /** * Status starting. From 91079124dadbe9a6ea9460a567ee9b9b9fa3a7e3 Mon Sep 17 00:00:00 2001 From: walkor Date: Mon, 31 Jul 2023 14:07:30 +0800 Subject: [PATCH 7/7] Update Worker.php --- Worker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Worker.php b/Worker.php index 1a91c85dd..b5ed58c5d 100644 --- a/Worker.php +++ b/Worker.php @@ -34,7 +34,7 @@ class Worker * * @var string */ - const VERSION = '4.0.47'; + const VERSION = '4.0.46'; /** * Status starting.