Skip to content

Workaround for compatibility with PHP 8.6+ - #245

Closed
mbeccati wants to merge 1 commit into
guzzle:3.0from
mbeccati:php86-compat
Closed

mbeccati wants to merge 1 commit into
guzzle:3.0from
mbeccati:php86-compat

Conversation

@mbeccati

@mbeccati mbeccati commented Oct 2, 2026

Copy link
Copy Markdown

Usage of is as a class name is deprecated.

See php/php-src#23990

Comment thread src/Is.php Outdated
namespace GuzzleHttp\Promise;
(function (): void {
$original = error_reporting();
error_reporting($original ^ E_DEPRECATED);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks it should be $original & ~E_DEPRECATED

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

and how it will work with --classmap-authoritative

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point, the workaround is not compatible with --classmap-authoritative

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've also unsuccessfully tried a few variants.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@mbeccati for Drupal this patch approach works... at least all tests finally passed

Usage of `is` as a class name is deprecated.
@GrahamCampbell

Copy link
Copy Markdown
Member

Either PHP will revert this, or I will rename the class (aka add a new class and deprecate this one).

@GrahamCampbell

Copy link
Copy Markdown
Member

Trying to work around this is wrong IMO. If people were supposed to do this, then why is PHP even bothering with depreciations at all.

@mbeccati
mbeccati deleted the php86-compat branch October 5, 2026 12:25
@mbeccati

mbeccati commented Oct 5, 2026 •

Copy link
Copy Markdown
Author

As a RM, I'm afraid I don't have the power to revert this change.

It has been voted upon and "is" is going to be a reserved keyword in the pattern matching RFC, which is likely to pass in future. A depracation phase is in order to give time to adjust, by not raising a fatal error.

I was just trying to help with a workaround that would allow a potential 3.0.3 to be compatible with 8.6 without any deprecation being raised.

@GrahamCampbell

Copy link
Copy Markdown
Member

That's OK I don't expect it to be reverted. I would still question what the point of raising deprecations in the engine is if it is expected that userland works around them.

@mbeccati

Copy link
Copy Markdown
Author

Well, a deprecation warns the user that something is going to change, giving them time to adjust before becoming a fatal error in a future version.

@GrahamCampbell

Copy link
Copy Markdown
Member

Then why are we working around it in any way other than not using that class name? ;)

@mbeccati

Copy link
Copy Markdown
Author

@GrahamCampbell the workaround was excusively to add 8.6 compatibility to the current version(s). Renaming the class would be left for a next major update.

@GrahamCampbell

Copy link
Copy Markdown
Member

But it is already compatible? A deprecation is not an incompatibility. Only the actual disallowing of the class by the engine is an incompatibility. If people treat deprecations as incompatibilities, then there is no point in deprecations.

@mbeccati

Copy link
Copy Markdown
Author

If the deprecation is in a project I manage, I can deal with it if I want to. If the deprecation is triggered by a library my project uses, it in an annoyance as I can't do anything about it. Some would probably also report it in a GH issue.

Of course, as the project maintainer you can certainly decide not to do anything about it. Otherwise planning a release that adds a workaround could be a nice gesture to the users. Your call indeed. I think I've spent more than enough on this already ;-)

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

Successfully merging this pull request may close these issues.

3 participants