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

Skip to content

Commit 0655871

Browse files
Merge branch '6.4' into 7.1
* 6.4: [HttpClient] Fix empty hosts in option "resolve"
2 parents 878b4e3 + a39dd66 commit 0655871

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
@@ -208,9 +208,8 @@ private static function mergeDefaultOptions(array $options, array $defaultOption
208208
$options['resolve'] = [];
209209
foreach ($resolve as $k => $v) {
210210
if ('' === $v = (string) $v) {
211-
throw new InvalidArgumentException(sprintf('Option "resolve" for host "%s" cannot be empty.', $k));
212-
}
213-
if ('[' === $v[0] && ']' === substr($v, -1) && str_contains($v, ':')) {
211+
$v = null;
212+
} elseif ('[' === $v[0] && ']' === substr($v, -1) && str_contains($v, ':')) {
214213
$v = substr($v, 1, -1);
215214
}
216215

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

0 commit comments

Comments
 (0)
0