Closed
Description
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
.