Skip to content

[HttpClient] CurlHttpClient::createRedirectResolver(): Argument #2 ($host) must be of type string, null given #57976

@bt-nn

Description

@bt-nn

Symfony version(s) affected

6.4.10, 5.4.41

Description

When $url is missing a / like $url = 'https:/www.example.org';
$client->request('GET', $url);
exits with

6.4.10
In CurlHttpClient.php line 407:
Symfony\Component\HttpClient\CurlHttpClient::createRedirectResolver(): Argument #2 ($host) must be of type string, 
null given, called in /var/www/vendor/symfony/http-client/CurlHttpClient.php on line 326

5.4.41
In CurlHttpClient.php line 408:
Argument 2 passed to Symfony\Component\HttpClient\CurlHttpClient::createRedirectResolver() must be of the type string,
null given, called in /var/www/vendor/symfony/http-client/CurlHttpClient.php on line 322

shouldnt it throw a Symfony\Component\HttpClient\Exception\InvalidArgumentException?

How to reproduce

use Symfony\Component\HttpClient\HttpClient;

$url = 'https:/www.example.org';
$client = HttpClient::create();
$client->request('GET', $url);

Possible Solution

No response

Additional Context

No response

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