Skip to content

Commit daa0aca

Browse files
lacatoirelacatoire
andauthored
Remove deprecated curl_close() calls for PHP 8.5 compatibility (#2009)
Co-authored-by: lacatoire <louis-arnaud.catoire@external.drivalia.com>
1 parent 5bb7f31 commit daa0aca

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

src/Monolog/Handler/Curl/Util.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ final class Util
3737
* @param CurlHandle $ch curl handler
3838
* @return bool|string @see curl_exec
3939
*/
40-
public static function execute(CurlHandle $ch, int $retries = 5, bool $closeAfterDone = true): bool|string
40+
public static function execute(CurlHandle $ch, int $retries = 5): bool|string
4141
{
4242
while ($retries > 0) {
4343
$retries--;
@@ -48,19 +48,11 @@ public static function execute(CurlHandle $ch, int $retries = 5, bool $closeAfte
4848
if (false === \in_array($curlErrno, self::$retriableErrorCodes, true) || $retries === 0) {
4949
$curlError = curl_error($ch);
5050

51-
if ($closeAfterDone) {
52-
curl_close($ch);
53-
}
54-
5551
throw new \RuntimeException(sprintf('Curl error (code %d): %s', $curlErrno, $curlError));
5652
}
5753
continue;
5854
}
5955

60-
if ($closeAfterDone) {
61-
curl_close($ch);
62-
}
63-
6456
return $curlResponse;
6557
}
6658
return false;

src/Monolog/Handler/LogglyHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ protected function send(string $data, string $endpoint): void
146146
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
147147
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
148148

149-
Curl\Util::execute($ch, 5, false);
149+
Curl\Util::execute($ch, 5);
150150
}
151151

152152
protected function getDefaultFormatter(): FormatterInterface

0 commit comments

Comments
 (0)