Skip to content

Commit 31bc58f

Browse files
[HttpClient] fix requests to hosts that idn_to_ascii() cannot handle
1 parent 65ccb6c commit 31bc58f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

HttpClientTrait.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,7 @@ private static function parseUrl(string $url, array $query = [], array $allowedS
441441
throw new InvalidArgumentException(sprintf('Unsupported IDN "%s", try enabling the "intl" PHP extension or running "composer require symfony/polyfill-intl-idn".', $host));
442442
}
443443

444-
if (false === $host = \defined('INTL_IDNA_VARIANT_UTS46') ? idn_to_ascii($host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) : strtolower($host)) {
445-
throw new InvalidArgumentException(sprintf('Unsupported host in "%s".', $url));
446-
}
447-
444+
$host = \defined('INTL_IDNA_VARIANT_UTS46') ? idn_to_ascii($host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) ?: strtolower($host) : strtolower($host);
448445
$host .= $port ? ':'.$port : '';
449446
}
450447

0 commit comments

Comments
 (0)