WordPress offered guidance about compatibility of new WordPress 5.6 with PHP 8 and what that means for publishers.
WordPress is updating soon to version 5.6 which aims to be compatible with PHP 8. However, WordPress cautioned that it should be considered “beta-compatible” and explained why upgrading to PHP 8 should at this time be done with care.
Background on PHP
PHP is a programming language that is run on a server to generate a web page. WordPress itself is created with the PHP language.
The current version of PHP is PHP 7x. The “x” is a reference to the different versions of PHP 7, which currently represent 7.2, 7.3 and 7.4.
Versions prior to 7.2 have reached their “end of life” (EOL) and are longer being updated with security patches.
The oldest version, 7.2, is due to reach EOL on November 30, 2020. That means it will no longer receive security updates and because of that it will become a potential security liability for any site still using it, should a vulnerability be discovered in the future.
Version 7.3 is scheduled to reach EOL on December 6, 2021.
Publishers Have Until 2022 to Update to PHP 8?
The current and most up to date version of PHP 7.x is version 7.4. PHP 7.4 reaches EOL on November 8, 2022.
What that means is that technically, WordPress publishers have two years to decide on when to update their PHP version to PHP 8. In practice however, most WordPress publishers should be able to update to PHP 8 well before that time.
Why WordPress 5.6 is Beta Compatible
WordPress announced that the latest WordPress version due in December 2020 should be compatible with PHP 8. However, WordPress cautioned that it is still possible that undiscovered incompatibilities may still exist.
That is an acknowledgement of the reality that while the core WordPress install may be compatible with PHP 8, there still exists the possibility that something was overlooked.
This is how the WordPress 5.6 PHP 8 guidance phrased it:
“WordPress Core aims to be compatible with PHP 8.0 in the 5.6 release (currently scheduled for December 8, 2020).
…Significant effort has been put towards making WordPress 5.6 compatible with PHP 8 on its own, but it is very likely that there are still undiscovered issues remaining.”
The fact of there being “undiscovered issues remaining” is not a negative statement about the WordPress 5.6 release. It’s a pragmatic acknowledgement that in programming, as in many engineering activities, there is almost always the possibility that unforeseen mistakes or oversights exist.
Perhaps a more important consideration is the uncertainty of when themes and plugins will become PHP 8 compatible. This more than anything else, could contribute to holding WordPress back from being considered fully PHP 8 compatible.
The official WordPress 5.6 guidance advised:
“It also should be acknowledged that WordPress is never used in isolation (without any theme or plugins), so WordPress itself being able to run on PHP 8 does not indicate “full” compatibility.
The state of PHP 8 support within the broader ecosystem (plugins, themes, etc.) is impossible to know. For that reason, WordPress 5.6 should be considered “beta compatible” with PHP 8.”
WordPress 5.6 is “Beta Compatible” with PHP 8
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 be 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.”
The Yoast report concludes:
“PHP 8 is going to contain a lot of breaking changes.”
“Breaking changes” is a reference to changes that result in an error when a theme or plugin uses code that is no longer supported in PHP 8.
PHP 8 and WordPress
PHP 8 represents an important step forward for the publishing world, particularly for users of WordPress. One of the benefits is that it will be more security.
The guidance from WordPress regarding updating to PHP 8 is to recommend caution:
“…it is highly recommended that you thoroughly test your site before upgrading to PHP 8.”
The fact that WordPress itself calls WordPress 5.6 “beta-compatible” with PHP 8 tells you all you need to know regarding whether you should update to PHP 8 or not.