Skip to content

[HttpClient] CURLOPT_STDERR resource has gone away #31985

@valentin-harrang

Description

@valentin-harrang

Symfony version(s) affected: 4.3.1

Description
I try to send GET request (there is the same problem with another method):

   protected const ENDPOINT_LISTS     = 'lists';

    /**
     * @var string
     */
    protected $apiKey;

    /**
     * @var string
     */
    protected $dataCenter;

    /**
     * @var HttpClient
     */
    protected $httpClient;

    /**
     * @var string
     */
    protected $password;

    /**
     * @var string
     */
    protected $user;

    public function __construct(string $apiKey, string $dataCenter, string $password, string $user)
    {
        $this->httpClient = HttpClient::create([
            'base_uri' => 'https://' . $dataCenter . '.api.mailchimp.com/3.0/',
            'timeout'  => 5,
            'headers'  => [
                'Authorization' => 'Basic ' . base64_encode($user . ':' . $password),
            ],
        ]);

        $this->apiKey     = $apiKey;
        $this->dataCenter = $dataCenter;
        $this->user       = $user;
        $this->password   = $password;
    }

    public function getLists(): ?array
    {
        $response = $this->httpClient->request(Request::METHOD_GET, self::ENDPOINT_LISTS);

        if ($response instanceof Response && $response->getStatusCode() === HttpFoundationResponse::HTTP_OK) {
            return $this->getContents($response);
        }

        return null;
    }

    protected function getContents(Response $response): ?array
    {
        return json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
    }

I get this error in the profiler:

Uncaught PHP Exception ErrorException: "Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr" at /var/www/my_project/vendor/symfony/http-client/Response/CurlResponse.php line 260

Additional context
Sans titre

image

In the "replaces" section, I have both, alternate dependencies and replaced dependencies: https://packagist.org/packages/symfony/contracts

image

image

I'm using PHP version 7.3.6 FPM and I have Composer 1.8.5 version

See previous report : #31803

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