On Monday, WordPress core contributor Jonathan Desrosiers published a detailed post on the Make WordPress Core blog about the upcoming PHP 8 release and how it affects WordPress.
PHP 8 Is Coming
Scheduled for release on November 26, 2020, PHP 8 is the next major update to our favorite scripting language. While previous PHP releases have not had too much of an adverse effect on the WordPress ecosystem, this update has some breaking changes that could affect backward compatibility. It should also be noted that many features that were deprecated in PHP 7.x will now be removed in PHP 8.
The Status of WordPress Core
In his post, Desrosiers highlights the work that has been done to keep the core software up to date. “WordPress Core aims to be compatible with PHP 8.0 in the 5.6 release (currently scheduled for December 8, 2020),” he wrote.
However, this does not mean it is safe to upgrade to PHP 8 when WordPress 5.6 is released. WordPress is rarely run just on its own and usually relies on at least one theme and a collection of plugins to function as a blog or web site. As such, he points out, “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.“
What this means, essentially, is that until most major themes and plugins are PHP 8 compatible, WordPress cannot be considered fully compatible.
Understand How PHP 8 Could Affect Your Plugin or Theme
Companies like Yoast have been preparing for this for a little while now. In late October, Yoast CTO Omar Reiss, along with fellow contributors Juliette Reinders Folmer, maintainer of the WordPress Coding Standards Sniffs for PHPCS, and Yoast DevOps manager Herre Groen, compiled and published a comprehensive WordPress/PHP 8 compatibility report.
While I highly recommend you take the time to read through the entire report, it does outline the main reason that the PHP 8 upgrade could have such a drastic effect on large WordPress sites, especially the plugin and theme ecosystem.
“However, PHP 7.* versions have seen a far larger set of deprecations than previous versions of PHP. Where PHP 5.6 to PHP 7 was a relatively simple migration, going from 7.x to 8 could be very painful, especially for very old codebases, like WordPress and many of the plugins that are available for it. For well-typed codebases or codebases which have stayed up-to-date with the latest PHP versions, there isn’t a big problem.”
As a maintainer of a few plugins, some built on code dating back eight years, it is worrisome that this upgrade could cause sites to break.
How to Prepare Yourself
I asked Reiss and Folmer what plugin and theme developers can do to get ready, and they shared some pointers.
First and foremost, developers should inform themselves about the changes coming in PHP 8: read the Make post about PHP 8, read the Yoast PHP8 Compatibility report, read the “Migrating from PHP 7.4 to PHP 8.0” section of the PHP manual, and potentially dig deeper by reading the UPGRADING doc in the PHP 8 branch and the RFCs for PHP 8.
Some available tools can be used to help look for incompatibilities:
There Is Still Time, But It Is Running Out
As Desrosiers pointed out in the Make post, WordPress is only officially aiming to be PHP 8 ready by the time 5.6 is released in early December. Potentially, this means that many WordPress-focused hosting companies will only consider offering upgrades to their customers once WordPress core is compatible. So as plugin and theme developers, we have some time to test our products and get them ready, but that window is closing fast.
Fortunately for us, the knowledge and tools to get up to date are out there. We merely need to put them into action.
This content was originally published here.