From 6a98c9fe609f3b07572bafb476ec7e650f7abe01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E3=80=81=E7=A7=8B=E7=A7=8B=E7=A7=8B=E7=A7=8B?= =?UTF-8?q?=E7=A7=8B=E7=A7=8B=E7=A7=8B?= <409703312@qq.com> Date: Mon, 27 Jan 2025 18:12:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E6=9E=90=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E4=BC=9A=E6=8A=A5=E9=94=99substr():=20Argume?= =?UTF-8?q?nt=20#1=20($string)=20must=20be=20of=20type=20string,=20bool=20?= =?UTF-8?q?given?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Protocols/Http/Request.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Protocols/Http/Request.php b/src/Protocols/Http/Request.php index b8c3049a..cbb0dc35 100644 --- a/src/Protocols/Http/Request.php +++ b/src/Protocols/Http/Request.php @@ -419,8 +419,9 @@ protected function parseHeadFirstLine(): void protected function parseProtocolVersion(): void { $firstLine = strstr($this->buffer, "\r\n", true); - $protocolVersion = substr(strstr($firstLine, 'HTTP/'), 5); - $this->data['protocolVersion'] = $protocolVersion ?: '1.0'; + $httpStr = strstr($firstLine, 'HTTP/'); + $protocolVersion = $httpStr ? substr($httpStr, 5) : '1.0'; + $this->data['protocolVersion'] = $protocolVersion; } /**