Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 61c1175

Browse filesBrowse files
bug #38173 [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm (ybenhssaien)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | no | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> If option is `auth_ntlm` an exception is thrown, `$alternatives` then is not used. Commits ------- ab1a96c [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm
2 parents e368bb4 + ab1a96c commit 61c1175
Copy full SHA for 61c1175

File tree

Expand file treeCollapse file tree

1 file changed

+11
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-5
lines changed

‎src/Symfony/Component/HttpClient/HttpClientTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/HttpClientTrait.php
+11-5Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
111111
}
112112

113113
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._=~+/0-9a-zA-Z]++$}', $options['auth_bearer']))) {
114-
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, %s given.', \is_string($options['auth_bearer']) ? 'invalid string' : '"'.\gettype($options['auth_bearer']).'"'));
114+
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, '.(\is_string($options['auth_bearer']) ? 'invalid string given.' : '"%s" given.'), \gettype($options['auth_bearer'])));
115115
}
116116

117117
if (isset($options['auth_basic'], $options['auth_bearer'])) {
@@ -197,6 +197,16 @@ private static function mergeDefaultOptions(array $options, array $defaultOption
197197
continue;
198198
}
199199

200+
if ('auth_ntlm' === $name) {
201+
if (!\extension_loaded('curl')) {
202+
$msg = 'try installing the "curl" extension to use "%s" instead.';
203+
} else {
204+
$msg = 'try using "%s" instead.';
205+
}
206+
207+
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" is not supported by "%s", '.$msg, __CLASS__, CurlHttpClient::class));
208+
}
209+
200210
$alternatives = [];
201211

202212
foreach ($defaultOptions as $key => $v) {
@@ -205,10 +215,6 @@ private static function mergeDefaultOptions(array $options, array $defaultOption
205215
}
206216
}
207217

208-
if ('auth_ntlm' === $name) {
209-
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" is not supported by "%s", try using CurlHttpClient instead.', __CLASS__));
210-
}
211-
212218
throw new InvalidArgumentException(sprintf('Unsupported option "%s" passed to "%s", did you mean "%s"?', $name, __CLASS__, implode('", "', $alternatives ?: array_keys($defaultOptions))));
213219
}
214220

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.