From 5b7a9593be1b7937c8b9152e3efae3ee6922d571 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Wed, 15 Sep 2021 02:03:24 -0400 Subject: [PATCH] Fix response length calculation when curl_exec() returns false on failure --- src/Curl/Curl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index fa33eb7..28544b0 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -1461,7 +1461,8 @@ class Curl $request_body_empty = empty($this->getOpt(CURLOPT_POSTFIELDS)); $response_header_length = isset($this->responseHeaders['Content-Length']) ? $this->responseHeaders['Content-Length'] : '(not specified in response header)'; - $response_calculated_length = strlen($this->rawResponse); + $response_calculated_length = is_string($this->rawResponse) ? + strlen($this->rawResponse) : '(' . var_export($this->rawResponse, true) . ')'; $response_headers_count = count($this->responseHeaders); echo