[wp-trac] [WordPress Trac] #58719: Bump the minimum PHP version to 7.2
WordPress Trac
noreply at wordpress.org
Thu Apr 4 21:11:45 UTC 2024
#58719: Bump the minimum PHP version to 7.2
-------------------------+--------------------------
Reporter: justlevine | Owner: johnbillion
Type: enhancement | Status: accepted
Priority: normal | Milestone: 6.6
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+--------------------------
Comment (by jrf):
Thanks @johnbillion for updating the proposed patch.
For the record: I fully support upping the minimum supported PHP version
to PHP 7.2 (or even 7.3) sooner rather than later.
Keeping WP running PHP cross-version will be getting more and more painful
if we don't.
Some examples:
**SimplePie** has [https://github.com/simplepie/simplepie/pull/743 dropped
support for PHP < 7.2 in version 1.8.0] which was released in January
2023.
WordPress currently cannot update SimplePie anymore, but older SimplePie
versions will not receive patches to support newer PHP versions, like PHP
8.3 or PHP 8.4.
While **Sodium_Compat** (previously discussed as still necessary)
currently still has a minimum supported PHP version of PHP 5.2.4, I would
be very surprised if that doesn't get raised to PHP 7.1 in the foreseeable
future.
The Sodium_Compat library, in particular, is impacted by the PHP 8.4
[https://wiki.php.net/rfc/deprecate-implicitly-nullable-types "implicitly
nullable parameters" deprecation] with 36 instances needing fixing.
If PHP < 7.1 would continue to be supported, they would need to drop the
type declarations of the affected function parameters, which is a
significant BC-break as their classes are not `final`.
If they'd raise the minimum supported version to 7.1, they can fix these
issues by using nullable types.
For ''most'' end-users of Sodium Compat, that wouldn't be a problem as
those projects use Composer and Composer can sort out that a version is
installed which is compatible with the server on which the package is
being run.
However, WordPress is not one of those users and shipping WP with two
different versions, while doable, is probably still not the best of ideas.
**Requests** has already fixed that deprecation, but this means it had to
make a [https://github.com/WordPress/Requests/releases/tag/v2.0.11
potential breaking change], though this was (of course) done after careful
research of uses of the one method for which this BC-break was needed.
And while the **GetID3** package - for now - still has a minimum of PHP
5.4 for their 2.0 release, there is
[https://github.com/JamesHeinrich/getID3/issues/317 a discussion going to
change this to PHP 7.2] too.
Aside from the above, **PHP_CodeSniffer** will also have a PHP 7.2 minimum
as of version 4.0, which is expected sometimes over the next few months.
This decision was already taken years ago when the 4.0 branch was created
(2020).
When **WordPressCS** will be made compatible with PHPCS 4.0, it is likely
that the minimum supported PHP version for WPCS will need to be raised to
PHP 7.2 as well, even if PHPCS 3.0 would still be supported.
As WordPress should always try to enforce the latest version of its own
coding standards, we cannot allow for an older WPCS version to be
installed by contributors, which would create an ugly conundrum as WP
having a dev dependency with a higher minimum PHP version than its own
minimum PHP version is problematic.
On top of all that, I've seen some recent patches in WP which introduced
parameter type declarations. While this is not a great idea in the context
of WordPress in the first place, though that's beside the point, the
problem in light of this ticket is that PHP < 7.4 doesn't fully support
co-variance or contra-variance. And while PHP 7.2 doesn't offer full
support yet, it is the PHP version in which the first significant steps
were taken to add support for co-variance and contra-variance to PHP.
Either way, that's my two pennies. Hope it helps to inform the decision by
the powers that be.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58719#comment:45>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list