Skip to content

Commit

Permalink
Merge pull request #1088 from lengqiuqiuqiu/master
Browse files Browse the repository at this point in the history
解析的时候可能会报错substr(): Argument #1 ($string) must be of type string, bool given
  • Loading branch information
walkor authored Jan 27, 2025
2 parents ea829e3 + f41eca7 commit d5654a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Protocols/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit d5654a7

Please sign in to comment.