8000 Merge branch '7.1' into 7.2 · symfony/symfony@a8621e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit a8621e8

Browse files
Merge branch '7.1' into 7.2
* 7.1: [HttpClient] Fix empty hosts in option "resolve"
2 parents 0d76fde + 0655871 commit a8621e8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Symfony/Component/HttpClient/HttpClientTrait.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,8 @@ private static function mergeDefaultOptions(array $options, array $defaultOption
207207
$options['resolve'] = [];
208208
foreach ($resolve as $k => $v) {
209209
if ('' === $v = (string) $v) {
210-
throw new InvalidArgumentException(sprintf('Option "resolve" for host "%s" cannot be empty.', $k));
211-
}
212-
if ('[' === $v[0] && ']' === substr($v, -1) && str_contains($v, ':')) {
210+
$v = null;
211+
} elseif ('[' === $v[0] && ']' === substr($v, -1) && str_contains($v, ':')) {
213212
$v = substr($v, 1, -1);
214213
}
215214

@@ -237,9 +236,8 @@ private static function mergeDefaultOptions(array $options, array $defaultOption
237236
if ($resolve = $defaultOptions['resolve'] ?? false) {
238237
foreach ($resolve as $k => $v) {
239238
if ('' === $v = (string) $v) {
240-
throw new InvalidArgumentException(sprintf('Option "resolve" for host "%s" cannot be empty.', $k));
241-
}
242-
if ('[' === $v[0] && ']' === substr($v, -1) && str_contains($v, ':')) {
239+
$v = null;
240+
} elseif ('[' === $v[0] && ']' === substr($v, -1) && str_contains($v, ':')) {
243241
$v = substr($v, 1, -1);
244242
}
245243

0 commit comments

Comments
 (0)
0