Skip to content

Commit

Permalink
更新说明,降低 PHP 版本依赖至 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Mar 27, 2020
1 parent e122666 commit 25dc771
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ v1.0-1.3 初期版本迭代
```json
{
"require": {
"yurunsoft/yurun-http": "^4.1.0"
"yurunsoft/yurun-http": "^4.2.0"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/YurunHttp.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class YurunHttp
/**
* 版本号
*/
const VERSION = '4.1';
const VERSION = '4.2';

/**
* 设置默认处理器类
Expand Down
5 changes: 5 additions & 0 deletions src/YurunHttp/Handler/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ private function getResponse($handler, $curlResult, $isDownload, $receiveHeaders
$headerSize = curl_getinfo($handler, CURLINFO_HEADER_SIZE);
$headerContent = substr($curlResult, 0, $headerSize);
$body = substr($curlResult, $headerSize);
// PHP 7.0.0开始substr()的 string 字符串长度与 start 相同时将返回一个空字符串。在之前的版本中,这种情况将返回 FALSE 。
if(false === $body)
{
$body = '';
}

// body
$result = new Response($body, curl_getinfo($handler, CURLINFO_HTTP_CODE));
Expand Down

0 comments on commit 25dc771

Please sign in to comment.