Repository: symfony/symfony
File: src/Symfony/Component/HttpClient/Internal/CurlClientState.php (PHP)

Code before:
        if ($this->allowPersistentHandles && \PHP_VERSION_ID < 80500) {
            $this->allowPersistentHandles = false;
            @trigger_error('Upgrade PHP to version 8.5 to enable persistent handles.', \E_USER_WARNING);
        }
    }

    public function reset(): void
    {
        foreach ($this->pushedResponses as $url => $response) {
            $this->logger?->debug(\sprintf('Unused pushed response: "%s"', $url));
            curl_multi_remove_handle($this->handle, $response->handle);
        }

        $this->pushedResponses = [];
        $this->dnsCache->evictions = $this->dnsCache->evictions ?: $this->dnsCache->removals;
        $this->dnsCache->removals = $this->dnsCache->hostnames = [];

        if (!$this->allowPersistentHandles) {
            unset($this->share);
        }
    }

    public function __get(string $name): mixed
    {
        if ('share' === $name) {
            if ($this->allowPersistentHandles && (\PHP_VERSION_ID >= 80500)) {
                $this->share = curl_share_init_persistent([
                    \CURL_LOCK_DATA_DNS,
                    \CURL_LOCK_DATA_SSL_SESSION,
                    \CURL_LOCK_DATA_CONNECT,
                ]);
            } else {
                $this->share = curl_share_init();
                curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_DNS);
                curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_SSL_SESSION);
                curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_CONNECT);
            }

            return $this->share;
        }

        if ('handle' === $name) {
            $this->handle = curl_multi_init();

            // Don't enable HTTP/1.1 pipelining: it forces responses to be sent in order
            if (\defined('CURLPIPE_MULTIPLEX')) {
                curl_multi_setopt($this->handle, \CURLMOPT_PIPELINING, \CURLPIPE_MULTIPLEX);
            }
            if (\defined('CURLMOPT_MAX_HOST_CONNECTIONS') && 0 < $this->maxHostConnections) {
                $this->maxHostConnections = curl_multi_setopt($this->handle, \CURLMOPT_MAX_HOST_CONNECTIONS, $this->maxHostConnections) ? min(50 * $this->maxHostConnections, 4294967295) : $this->maxHostConnections;
            }

Review comment (suggestion):
```suggestion
            if (\PHP_VERSION_ID >= 80500 && $this->allowPersistentHandles) {
```

Code after:

    public function reset(): void
    {
        foreach ($this->pushedResponses as $url => $response) {
            $this->logger?->debug(\sprintf('Unused pushed response: "%s"', $url));
            curl_multi_remove_handle($this->handle, $response->handle);
        }

        $this->pushedResponses = [];
        $this->dnsCache->evictions = $this->dnsCache->evictions ?: $this->dnsCache->removals;
        $this->dnsCache->removals = $this->dnsCache->hostnames = [];

        unset($this->share);
    }

    public function __get(string $name): mixed
    {
        if ('persistentShare' === $name) {
            if (\PHP_VERSION_ID < 80500) {
                return $this->persistentShare = $this->share;
            }

            return $this->persistentShare = curl_share_init_persistent([
                \CURL_LOCK_DATA_DNS,
                \CURL_LOCK_DATA_SSL_SESSION,
                \CURL_LOCK_DATA_CONNECT,
            ]);
        }

        if ('share' === $name) {
            $this->share = curl_share_init();
            curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_DNS);
            curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_SSL_SESSION);
            curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_CONNECT);

            return $this->share;
        }

        if ('handle' === $name) {
            $this->handle = curl_multi_init();

            // Don't enable HTTP/1.1 pipelining: it forces responses to be sent in order
            if (\defined('CURLPIPE_MULTIPLEX')) {
                curl_multi_setopt($this->handle, \CURLMOPT_PIPELINING, \CURLPIPE_MULTIPLEX);
            }
            $maxHostConnections = $this->maxHostConnections;
            if (\defined('CURLMOPT_MAX_HOST_CONNECTIONS') && 0 < $maxHostConnections) {
                $maxHostConnections = curl_multi_setopt($this->handle, \CURLMOPT_MAX_HOST_CONNECTIONS, $maxHostConnections) ? min(50 * $maxHostConnections, 4294967295) : $maxHostConnections;
            }
            if (\defined('CURLMOPT_MAXCONNECTS') && 0 < $maxHostConnections) {
                curl_multi_setopt($this->handle, \CURLMOPT_MAXCONNECTS, $maxHostConnections);