8000 [HttpClient] Calling $httpClient->request(...) can result in unexpected exceptions · Issue #35458 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[HttpClient] Calling $httpClient->request(...) can result in unexpected exceptions #35458
Closed
@mleczakm

Description

@mleczakm

Symfony version(s) affected: Probably 4.4 / 5.0

Description
Calling $httpClient->request(...) (using Curl client) results in immediately destroyed CurlResponse object, which calls during destroying checkStatusCode method from ResponseTrait if no $this->info['error'] is set. Problem is that when request timed out over max_duration, $this->info['error'] can be empty (error message is shown in debug IIRC) and checking for status code throws exception.

How to reproduce

// create Symfony/HttpClient with max_duration, expect unexpected exceptions thrown from `doDestruct` method of `ResponseTrait`
$httpClient->request('HEAD', 'some-timing-out-url');

Possible Solution
Do not check status code in doDestruct method, fix empty $info['error'] when request timed out over max_duration.

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

      0