Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symfony/http-client idn_to_ascii raise exception for some domain #35852

Closed
warwar opened this issue Feb 24, 2020 · 1 comment
Closed

symfony/http-client idn_to_ascii raise exception for some domain #35852

warwar opened this issue Feb 24, 2020 · 1 comment

Comments

@warwar
Copy link

warwar commented Feb 24, 2020

Symfony version(s) affected: 4.4.4

Description
for domain 0-------------------------------------------------------------0.com raise InvalidArgumentException

How to reproduce
$http_client = HttpClient::create();
$response = $http_client->request('GET', 'http://0-------------------------------------------------------------0.com');

Possible Solution

Additional context
[Symfony\Component\HttpClient\Exception\InvalidArgumentException]
In HttpClientTrait.php line 446:
Unsupported host in "http://0-------------------------------------------------------------0.com/".

@nicolas-grekas
Copy link
Member

This looks like the normal behavior of idn_to_ascii(): https://3v4l.org/U0ct2
If you think that's an issue, please submit a bug report to https://bugs.php.net

What we can do in Symfony is replace the "if" block on that line with:
$host = \defined('INTL_IDNA_VARIANT_UTS46') ? idn_to_ascii($host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) ?: strtolower($host) : strtolower($host);

up for a PR with a test case?

nicolas-grekas added a commit that referenced this issue Mar 12, 2020
…not handle (nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fix requests to hosts that idn_to_ascii() cannot handle

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35852
| License       | MIT
| Doc PR        | -

Commits
-------

4b45685 [HttpClient] fix requests to hosts that idn_to_ascii() cannot handle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants