WordPress 5.6 and PHP 8 compatibility
WP offered guidance regarding the compatibility of the new WordPress 5.6 with PHP 8 and what this means for publishers.
WordPress 5.6 and PHP 8 compatibility
WordPress is soon updating to version 5.6 which is intended to be compatible with PHP 8. However, WordPress cautioned that it should be considered “beta-compatible” and explained why one should upgrade to PHP 8 at this time
Background on php
PHP is a programming language run on a server to generate a web page. WordPress itself is built with PHP language.
The current version of PHP is PHP 7x. “X” is a reference to various versions of PHP 7, currently representing 7.2, 7.3 and 7.4.
Versions prior to 7.2 have reached their “end of life” (EOL) and are now being updated with security patches.
The oldest version, 7.2, is due to reach EOL on November 30, 2020. This means that it will no longer receive security updates and because of this it will become a potential security obligation for any site still using it should a vulnerability be discovered. Future.
Version 7.3 is schedule to reach EOL on December 6, 2021.
Do publishers have to update to PHP 8 by 2022?
The current and most up-to-date version of PHP 7.x is 7.4. PHP 7.4 reaches EOL on November 8, 2022.
What this means is that technically, WordPress publishers have two years to update their PHP version to PHP 8. However, most WordPress publishers should be able to update to PHP 8 well before that time.
Why WordPress 5.6 Beta is compatible?
WordPress announced that in December 2020 the latest WordPress version should be compatible with PHP 8. However, WordPress cautioned that it is still possible that undiscovered inconsistencies still exist.
It is an acceptance of the reality that while the core WordPress installation may be compatible with PHP 8, there still exists the possibility that something was overlooked.
This is how the WordPress 5.6 PHP 8 guide:
“WordPress Core aims to compatible with PHP 8.0 in the 5.6 release (currently scheduled for December 8, 2020).
… There has been significant effort to make WordPress 5.6 compatible with PHP 8, but it is very likely that there are still unseen issues left. “
The fact that there are “unseen issues remaining” about the WordPress 5.6 release is not a negative statement. It is a practical assumption that in programming, as in many engineering activities, there is almost always the possibility that unexpected mistakes or oversights are present.
Perhaps the more important consideration is the uncertainty of when themes and plugins will become PHP 8 compatible. This may contribute to keeping WordPress back from being considered fully PHP 8 compatible, more than anything else.
Official WordPress 5.6 guidance recommended:
“It should also be acknowledged that WordPress is not used in isolation (without any themes or plugins), so WordPress itself is capable of running on PHP 8 does not imply” full “compatibility.
It is impossible to know the status of PHP 8 support within the wider ecosystem (plugins, themes, etc.). For that reason, WordPress 5.6 should be considered “beta compatible” with PHP 8.
WordPress 5.6 is “Beta Compatible” with PHP 8a
In software development there are generally two final release versions. There’s an Alpha version and then a Beta version. The beta version is usually considered as maybe almost ready for release. The beta version of software is what comes before the final version of a software.
So when WordPress says that version 5.6 should be considered as “beta-compatible” that means there may be bugs and errors that haven’t yet been discovered.
Because themes and plugins may not yet be PHP 8 compatible, it’s probably prudent to not update until all plugins and themes have been verified to be PHP 8 compatible.
But even after themes and plugins are PHP 8 compatible, it may still be wise to wait at least a few more months to upgrade.
The reason is because PHP 8 is a major update. While themes and plugins may be considered PHP 8 compatible, it’s almost inevitable that bugs and other issues will be discovered in the PHP 8 compatible themes and plugins that are installed on a site.
Will Updating to PHP 8 Break WordPress Sites?
There are many old PHP functions from 7.x that are removed from PHP 8, which means that themes and plugins that still use them will break in PHP 8.
Wordfence recently estimated that for just one of the functions there are currently over 5,500 plugins installed in millions of sites. While the use of these functions in some cases are for backward compatibility, it’s not so on all of them.
“…we have identified that create_function is still used in over 5,500 WordPress plugins, including extremely popular plugins with millions of installations. In some cases use of these deprecated functions may be intended for backwards compatibility with older versions of PHP.
Many plugins, however, will need extensive refactoring as PHP 8 becomes more utilized.”
Yoast recently published a study about the PHP 8 readiness of plugins and themes within the WordPress ecosystem.
Breaking Changes in PHP 8
In the section of their report dealing with testing plugins and themes, Yoast concluded:
“Only a small percentage of the available plugins, the more popular and professionally developed ones, have automated tests in place. This is worrisome as generally speaking, the average WordPress site runs about 19 or 20 plugins.
…However, more than anything. The plugins/themes which have tests are likely the ones where the least amount of PHP 8.0 problems can expected as they use a professional development model.
The multitude of plugins and themes without tests are much more cause for concern as these will more likely to be problematic when run on PHP 8.”