Skip to content

Commit d4af2ea

Browse files
authored
Merge pull request #219 from qibinghua/master
CURLOPT_HTTPHEADER在php7接受空数组导致php-fpm奔溃
2 parents ea359d3 + 65bab3f commit d4af2ea

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

library/Requests/Transport/cURL.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,9 @@ protected function setup_handle($url, $headers, $data, $options) {
375375
curl_setopt($this->handle, CURLOPT_URL, $url);
376376
curl_setopt($this->handle, CURLOPT_REFERER, $url);
377377
curl_setopt($this->handle, CURLOPT_USERAGENT, $options['useragent']);
378-
curl_setopt($this->handle, CURLOPT_HTTPHEADER, $headers);
379-
378+
if (!empty($headers)) {
379+
curl_setopt($this->handle, CURLOPT_HTTPHEADER, $headers);
380+
}
380381
if ($options['protocol_version'] === 1.1) {
381382
curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
382383
}

0 commit comments

Comments
 (0)