Skip to content

PHP 8.5: Don't use deprecated curl_close() on PHP >= 8.0.0 #2004

@mpesari

Description

@mpesari

curl_close() is noop since 8.0.0 and emites E_DEPRECATED since 8.5.0.

It's used in Monolog\Handler\Curl\Util::execute() if $closeAfterDone = true.

It's the same for 1.x, 2.x and 3.x.

On 3.x we could just drop the $closeAfterDone parameter, but that might lead to backport difficulties.

One suggestion would be to check PHP_VERSION_ID on the top of the affected function:

// src/Monolog/Handler/Curl/Util.php

    public static function execute(CurlHandle $ch, int $retries = 5, bool $closeAfterDone = true): bool|string
    {
        if (\PHP_VERSION_ID >= 80000) {
            $closeAfterDone = false;
        }

        // ...
    }

This would retain similar code in all branches until old versions are dropped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions