Ensure Curl::rawResponse is a string

This commit is contained in:
Zach Borboa
2021-09-15 03:11:11 -04:00
parent 5b7a9593be
commit 6146e764f6
+7
View File
@@ -476,6 +476,13 @@ class Curl
}
$this->curlError = $this->curlErrorCode !== 0;
// Ensure Curl::rawResponse is a string as curl_exec() can return false.
// Without this, calling strlen($curl->rawResponse) will error the
// strict types setting is enabled.
if (!is_string($this->rawResponse)) {
$this->rawResponse = '';
}
// Transfer the header callback data and release the temporary store to avoid memory leak.
$this->rawResponseHeaders = $this->headerCallbackData->rawResponseHeaders;
$this->responseCookies = $this->headerCallbackData->responseCookies;