diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index c78f088ff7f3..5bb4ffbe859c 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -469,8 +469,10 @@ protected function applyMethod(string $method, array $curlOptions): array */ protected function applyBody(array $curlOptions = []): array { - if ($this->body !== '' && $this->body !== null) { - $curlOptions[CURLOPT_POSTFIELDS] = (string) $this->getBody(); + $requestBody = (string) $this->getBody(); + + if ($requestBody !== '') { + $curlOptions[CURLOPT_POSTFIELDS] = $requestBody; } return $curlOptions; @@ -529,7 +531,7 @@ protected function setCURLOptions(array $curlOptions = [], array $config = []) } // Certificate - if (array_key_exists('cert', $config) && $config['cert']) { + if (array_key_exists('cert', $config) && $config['cert'] !== '' || $config['cert'] !== []) { $cert = $config['cert']; if (is_array($cert)) { @@ -650,7 +652,7 @@ protected function setCURLOptions(array $curlOptions = [], array $config = []) } // version - if (array_key_exists('version', $config) && $config['version']) { + if (array_key_exists('version', $config) && ((is_string($config['version']) && $config['version'] !== '') || (is_numeric($config['version']) && $config['version'] !== 0))) { $version = sprintf('%.1F', $config['version']); if ($version === '1.0') { $curlOptions[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;