Commit 0dd5cfb
committed
bug #62699 [HttpClient] Fix
This PR was merged into the 6.4 branch.
Discussion
----------
[HttpClient] Fix `ScopingHttpClient` to always pass `base_uri` as `string` instead of parsed `array`
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix #62697
| License | MIT
### Problem
* `ScopingHttpClient` parsed the `base_uri` into an `array` (scheme, path, query, etc.).
* When passing this parsed value to a decorated client such as `RetryableHttpClient`, it caused errors.
* According to the `HttpClientInterface` in Symfony Contracts, `base_uri` [must be a string](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Contracts/HttpClient/HttpClientInterface.php#L45)
### Solution
* Updated `ScopingHttpClient` so it always forwards `base_uri` as a `string`, not as a parsed array.
* The change is applied for all decorated clients, not only `RetryableHttpClient`, since sending an `array` was not compliant with the `HttpClientInterface` comment.
### Additional Notes
Originally, the idea was to apply this fix only when the decorated client was `RetryableHttpClient` and later add full support for parsed `base_uri` for `RetryableHttpClient` in version 8.1.
However, after reviewing the `HttpClientInterface`, it became clear that sending a parsed `array` for `base_uri` was incorrect.
Therefore, the behavior is now corrected universally.
Commits
-------
9f80dd4 [HttpClient] Fix `ScopingHttpClient` to always pass `base_uri` as `string` instead of parsed `array`ScopingHttpClient to always pass base_uri as string instead of parsed array (santysisi)File tree
4 files changed
+39
-5
lines changed- src/Symfony/Component/HttpClient
- Tests
4 files changed
+39
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
174 | | - | |
| 173 | + | |
| 174 | + | |
175 | 175 | | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
179 | | - | |
| 180 | + | |
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
79 | 86 | | |
80 | 87 | | |
81 | 88 | | |
| |||
Lines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | | - | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
102 | 126 | | |
103 | 127 | | |
0 commit comments