Skip to content

[HttpClient] CurlHttpClient throws Undefined constant CURLOPT_PINNEDPUBLICKEY #42061

@sirian

Description

@sirian

Symfony version(s) affected: 5.3, 5.4

Description
Some CURL constants could be not defined depending on libcurl version.
Thus private CurlHttpClient::validateExtraCurlOptions throws Undefined constant "CURLOPT_PINNEDPUBLICKEY" even though user code doesn't use this constant.

\CURLOPT_PINNEDPUBLICKEY => 'peer_fingerprint',

For example CURLOPT_PINNEDPUBLICKEY requires libcurl 7.39.0

How to reproduce

You could try Centos 7 with remi PHP.

PHP 8.0.8
cURL support => enabled
cURL Information => 7.29.0
$client = new CurlHttpClient();
$response = $client->request('GET', 'https://download.geonames.org/export/dump/alternatenames/RU.zip', [
    'extra' => [
        'curl' => [
            CURLOPT_MAX_RECV_SPEED_LARGE => 1024
        ]
    ]
]);
var_dump(strlen($response->getContent()));

Possible Solution
Check that constant is defined(...) or add polyfill

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy