diff --git a/contrib/cloudflare.php b/contrib/cloudflare.php index 1f81d554c..1a89f0023 100644 --- a/contrib/cloudflare.php +++ b/contrib/cloudflare.php @@ -66,7 +66,9 @@ throw new \RuntimeException("Error making curl request (result: $res)"); } - curl_close($ch); + if (PHP_MAJOR_VERSION < 8) { + curl_close($ch); + } return $res; }; diff --git a/src/Command/InitCommand.php b/src/Command/InitCommand.php index d0ee35d18..221321d8f 100644 --- a/src/Command/InitCommand.php +++ b/src/Command/InitCommand.php @@ -115,7 +115,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int curl_setopt(\$ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt(\$ch, CURLOPT_TIMEOUT, 5); \$result = curl_exec(\$ch); - curl_close(\$ch); + if (PHP_MAJOR_VERSION < 8) { + curl_close(\$ch); + } \$json = json_decode(\$result); \$host = parse_url(\$json->blog, PHP_URL_HOST); file_put_contents('$tempHostFile', \$host); diff --git a/src/Support/Reporter.php b/src/Support/Reporter.php index 1066d226e..ae8ac85da 100644 --- a/src/Support/Reporter.php +++ b/src/Support/Reporter.php @@ -40,7 +40,9 @@ public static function report(array $stats): void curl_setopt(\$ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt(\$ch, CURLOPT_TIMEOUT, 5); \$result = curl_exec(\$ch); - curl_close(\$ch); + if (PHP_MAJOR_VERSION < 8) { + curl_close(\$ch); + } EOF); $php->start(); } diff --git a/src/Utility/Httpie.php b/src/Utility/Httpie.php index 19ee4eba7..986e64a7f 100644 --- a/src/Utility/Httpie.php +++ b/src/Utility/Httpie.php @@ -158,11 +158,15 @@ public function send(?array &$info = null): string } else { $error = curl_error($ch); $errno = curl_errno($ch); - curl_close($ch); + if (PHP_MAJOR_VERSION < 8) { + curl_close($ch); + } throw new HttpieException($error, $errno); } } - curl_close($ch); + if (PHP_MAJOR_VERSION < 8) { + curl_close($ch); + } return $result; }