Skip to content

Conversation

pierredup
Copy link
Contributor

@pierredup pierredup commented Oct 5, 2020

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tickets replaces #3646
License MIT
Doc PR N/A

Add support for PHP 8.

This PR removes some deprecations (mostly defining a required argument after an optional argument). It also aliases the Match class from Doctrine Mongodb since match is now a reserved keyword in PHP 8 and causes parse errors.

All the tests pass if they are run individually. The biggest outstanding issue is with Doctrine. Currently, it fails with the error Fatal error: Declaration of Doctrine\DBAL\Driver\PDOConnection::query() must be compatible with PDO::query(string $query, ?int $fetch_mode = null, mixed ...$fetch_mode_args).

This specific issue has been fixed in Doctrine 3.x (currently unreleased), but it's not possible to add it as a dev dependency currently as there are still a lot of other dependencies that don't allow Doctrine 3.x yet.

Copy link
Member

@dunglas dunglas left a comment

Choose a reason for hiding this comment

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

This looks good! I fear it introduces some small BC breaks but I don't think that they can be prevented.

@stephanvierkant
Copy link
Contributor

What's the status of this PR? I think the failing test is unrelated, isn't it?

@dunglas
Copy link
Member

dunglas commented Oct 14, 2020

Theoretically, this PR should be rebased against 2.5 as we consider supporting supporting new PHP versions as a bug fixes. However this PR introduces small (unavoidable) BC breaks, so merging it in a patch release doesn't look reasonable. WDYT @api-platform/core-team?

@alanpoulain
Copy link
Member

I think having this support for 2.6 is enough.

@antograssiot
Copy link
Contributor

👍 for 2.6 and the BC breaks must be added in the release note/changelog (+ maybe a new UPGRADING.md ?)

@dunglas
Copy link
Member

dunglas commented Oct 14, 2020

The problem is that we still have no ETA for 2.6. If only this version supports PHP 8, we'll have to release 2.6 before or just after the release of PHP 8.

@alanpoulain
Copy link
Member

The release of PHP 8 is the 26th of November. It's a good ETA don't you think?

@dunglas
Copy link
Member

dunglas commented Oct 15, 2020

Many things aren't ready yet. Especially regarding Vulcain's support in JS components.

@alanpoulain
Copy link
Member

Can't it be done later?

@dunglas
Copy link
Member

dunglas commented Oct 15, 2020

I'm not sure yet. Merging in 2.5 would be easier.

@pierredup
Copy link
Contributor Author

@dunglas Which changes are the BC breaks? Maybe there is a way around it, but I'm not sure which changes will break BC currently.

@dunglas
Copy link
Member

dunglas commented Oct 22, 2020

@pierredup ok I double checked and you're right, we're (again) safe because most of our classes are final 😬!
So could you rebase against 2.5 then?

Thanks!

@ashrpc
Copy link

ashrpc commented Oct 23, 2020

doctrine/dbal released new version 2.12.x which supports php8, no bc/code updates needed only update doctrine/dbal to 2.12.x. So is there any ETA for php8? Also u need to update https://github.com/willdurand/Negotiation package which supports php8 only in mater branch (3.0-dev) for now.

@dunglas
Copy link
Member

dunglas commented Oct 23, 2020

@dotdevru we'll merge this PR as soon as possible.

@dunglas
Copy link
Member

dunglas commented Oct 23, 2020

@pierredup do you want me to rebase it against 2.5?

@pierredup pierredup changed the base branch from master to 2.5 October 26, 2020 06:24
@pierredup
Copy link
Contributor Author

@dunglas I've rebased on 2.5 and removed the skipped tests since Doctrine DBAL now supports PHP 8.

@stephanvierkant
Copy link
Contributor

Any estimate when this will be merged (and tagged)?

@dunglas dunglas merged commit 8e58a98 into api-platform:2.5 Oct 26, 2020
@dunglas
Copy link
Member

dunglas commented Oct 26, 2020

Thank you very much @pierredup! Great work.

@stephanvierkant we need to finish #3794 before tagging a release.

@pierredup pierredup deleted the php-8 branch October 27, 2020 04:40
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.

7 participants