Skip to content
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

Supporting PHP 8.1 in Guzzle 6 #3109

Closed
ingluisjimenez opened this issue Mar 15, 2023 · 11 comments
Closed

Supporting PHP 8.1 in Guzzle 6 #3109

ingluisjimenez opened this issue Mar 15, 2023 · 11 comments

Comments

@ingluisjimenez
Copy link
Contributor

ingluisjimenez commented Mar 15, 2023

Guzzle version(s) affected: 6.5.x
PHP version: 8.1.x

Description
@GrahamCampbell Thank you for your continuing work supporting this great project.

We have been using it with PHP 8.0 for a couple of years without any issues and are in the process to migrate a large project to 8.1. We are aware that Guzzle 6 is only receiving security updates, but seems like there is only a minor issue to allow it to work with PHP 8.1.

Would you be open to merge/release a very small pull-request that addresses the compatibility issue with PHP 8.1? It would basically need this same change 74ca2cb?

We are onboard with the option of moving to Guzzle 7, but we are in the last steps of migrating to PHP 8.1 and that would introduce an additional set of requirements for the migration.

How to reproduce
N/A

Possible Solution
74ca2cb

Additional context
N/A

@GrahamCampbell
Copy link
Member

No, it is not possible to support PHP 8 in Guzzle 6. We don't just not support PHP 8.1, but we also don't support PHP 8.0 on Guzzle 6. That very small pull request is not any where near enough to support PHP 6 - we had to change thousands of lines in Guzzle 7 to support PHP 8.0, 8.1, and then 8.2, combined.

@GrahamCampbell
Copy link
Member

Guzzle 6 is PHP 5.5, 5.6 and 7 only. Guzzle 6 is also strictly speaking end of life now - we only commit to supporting the previous major version for 2 years, and it has been more than 2 years since the release of Guzzle 7.

@GrahamCampbell
Copy link
Member

You may find that Guzzle 6 appears to work with PHP 8.0, but are likely experiencing bugs and not even knowing, since it can "do the wrong thing", but not crash. I would very strongly recommend only using Guzzle 7 on any PHP 8 version.

@ingluisjimenez
Copy link
Contributor Author

Thank you for the feedback. I am surprised that you expect Guzzle 6 to not work at all with PHP 8.0, as we have been using it extensively for about 2 years now without any issues.

With that said, we will pursue the upgrade to Guzzle 7.

@GrahamCampbell
Copy link
Member

I don't remember all the details, but I think one of the handlers was affected more than the other (either the curl one, or the php streams one). Depending on which you are using, you may experience fewer issues. The supported PHP versions are documented at: https://github.com/guzzle/guzzle#version-guidance.

@GrahamCampbell
Copy link
Member

GrahamCampbell commented Mar 15, 2023

We also made upgrading to Guzzle 7 as easy as we could, so that people could get onto PHP 8 quickly. Most users will not need to change any code (that is, we provided replacements both in Guzzle 6 and 7, for things we were deleting in 7, so you could change code in Guzzle 6, then upgrade without changing anything).

@ingluisjimenez
Copy link
Contributor Author

Thank you for the guidance.

We have an internal package that wraps Guzzle and adds a few features on top of it. Updating that to use Guzzle 7 seemed straightforward. One of the main areas where we saw breaking changes was with the Request exceptions, and luckily we have our own exceptions equivalent to the Guzzle ones, so our services will require minor changes if any.

@Bendihossan
Copy link

Is there any reason the supported versions documented are not enforced by composer version constraints?

E.g.: shouldn't this show >= 5.5 < 8.0?
Screenshot 2023-05-05 at 11 26 42

I think that would help prevent people using of guzzle on unsupported platform versions.

@GrahamCampbell
Copy link
Member

It is too late to make that change (Composer will just install an older version of Guzzle 6, which is arguably worse), and it is common place to not do that in any case - see symfony/symfony#42993.

@GrahamCampbell
Copy link
Member

That is, support for new PHP version is treated as a bug fix, and as Guzzle 6 is out of bug fix support, that is a bug that will not be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants