Skip to content

Conversation

@santysisi
Copy link
Contributor

@santysisi santysisi commented Dec 8, 2025

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

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.

@carsonbot carsonbot added this to the 6.4 milestone Dec 8, 2025
@santysisi santysisi force-pushed the fix/ScopingHttpClient-baseuri branch 3 times, most recently from b2e344c to d2eec31 Compare December 9, 2025 00:18
Comment on lines 88 to 90
if (\is_array($options['base_uri'] ?? null)) {
$options['base_uri'] = $this->unparseUrl($options['base_uri']);
}
Copy link
Contributor Author

@santysisi santysisi Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m converting the URL back to a string because we currently allow passing base_uri as either a string or an array.
Ideally ( i think ), we should stop accepting arrays for base_uri, but removing that support in a patch or minor version would be a breaking change.

@santysisi santysisi force-pushed the fix/ScopingHttpClient-baseuri branch from d2eec31 to 04ba787 Compare December 9, 2025 00:59
@santysisi
Copy link
Contributor Author

status: needs work
I think there are some issues
I will see it again today in the night

@santysisi
Copy link
Contributor Author

status: needs review

@nicolas-grekas nicolas-grekas force-pushed the fix/ScopingHttpClient-baseuri branch from 165b263 to 9f80dd4 Compare December 10, 2025 12:18
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went a little bit further and I'm now unsetting the option when resolving URLs.
The code was able to cope with a parsed array instead of a string, but this conflicted with RetryableHttpClient's expectation and was also not documented as a valid type for the option.

@nicolas-grekas
Copy link
Member

Thank you @santysisi.

@nicolas-grekas nicolas-grekas merged commit 0dd5cfb into symfony:6.4 Dec 10, 2025
11 checks passed
@ngrie
Copy link

ngrie commented Dec 10, 2025

Thanks to both of you for fixing this 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants