Skip to content

[HttpClient] Handle Amp HTTP client v5 incompatibility gracefully #48173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2022

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Nov 9, 2022

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets #48143
License MIT
Doc PR -

symfony/http-client is not compatible with amphp/http-client ^5.
Currently, various class not found errors are thrown (classes that we use and that existed in v4 and that don't exist in v5).

@@ -30,7 +31,7 @@ final class HttpClient
*/
public static function create(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50): HttpClientInterface
{
if ($amp = class_exists(ConnectionLimitingPool::class)) {
if ($amp = class_exists(ConnectionLimitingPool::class) && interface_exists(Promise::class)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternatively, we could check 1 class/interface that exists in v4 and not in v5 here instead of having 2 checks. But I followed @kelunik (maintainer of amphp) suggestion of using this core amphp interface (http client v4 requires core v2 that has this interface, http client v5 requires core v3 that doesn't have this interface).

@fancyweb fancyweb force-pushed the http-client/fail-with-amp-5 branch from b2e3f0f to 7192c33 Compare November 9, 2022 11:27
@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

@nicolas-grekas nicolas-grekas merged commit d5ba532 into symfony:5.4 Nov 9, 2022
@fancyweb fancyweb deleted the http-client/fail-with-amp-5 branch November 9, 2022 12:48
@Bilge
Copy link
Contributor

Bilge commented Nov 9, 2022

There didn't need to be any tests for this?

@stof
Copy link
Member

stof commented Nov 9, 2022

We would have to make a special CI job that changes the dev requirement to install a different version and run a different test. That's quite hard to bring in our testsuite

@Bilge
Copy link
Contributor

Bilge commented Nov 9, 2022

I thought you might have a solution for it already, considering that even before this change, there is still the requirement to be able to test library switching and fallback.

@fabpot fabpot mentioned this pull request Nov 19, 2022
This was referenced Nov 28, 2022
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.

6 participants