From 0ce7c3d8411ebf78a1a36e3d648bfa3888415764 Mon Sep 17 00:00:00 2001 From: Jamie Burchell Date: Thu, 23 Oct 2025 09:54:49 +0100 Subject: [PATCH 1/2] Only call curl_close() in PHP < 8 --- contrib/cloudflare.php | 4 +++- src/Command/InitCommand.php | 4 +++- src/Support/Reporter.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) 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(); } From 9e3c5a8f3ae39979124d5aa98419cdaa5ede90ac Mon Sep 17 00:00:00 2001 From: Jamie Burchell Date: Thu, 23 Oct 2025 09:55:38 +0100 Subject: [PATCH 2/2] Patch Httpie.php to only call curl_close() in PHP < 8 --- src/Utility/Httpie.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; }