diff --git a/src/OAuth2/Client.php b/src/OAuth2/Client.php index c09fa5a..7fcbd7a 100644 --- a/src/OAuth2/Client.php +++ b/src/OAuth2/Client.php @@ -401,7 +401,7 @@ private function generateMACSignature($url, $parameters, $http_method) * @param int $form_content_type HTTP form content type to use * @return array */ - private function executeRequest($url, $parameters = array(), $http_method = self::HTTP_METHOD_GET, array $http_headers = null, $form_content_type = self::HTTP_FORM_CONTENT_TYPE_MULTIPART) + private function executeRequest($url, $parameters = array(), $http_method = self::HTTP_METHOD_GET, ?array $http_headers = null, $form_content_type = self::HTTP_FORM_CONTENT_TYPE_MULTIPART) { $curl_options = array( CURLOPT_RETURNTRANSFER => true, @@ -474,7 +474,11 @@ private function executeRequest($url, $parameters = array(), $http_method = self } else { $json_decode = json_decode($result, true); } - curl_close($ch); + + // Deprecated since PHP 8.0 + if (PHP_VERSION_ID < 80000 && is_resource($this->curl)) { + curl_close($this->curl); + } return array( 'result' => (null === $json_decode) ? $result : $json_decode,