WordPress

WordPress 5.6 and PHP 8 Compatibility Guide

WordPress is set to update soon to version 5.6, aiming for compatibility with PHP 8. However, WordPress advises that this compatibility is “beta-compatible” and explains why caution should be exercised when upgrading to PHP 8.

## Background on PHP

PHP is a server-side programming language used to generate web pages, and WordPress itself is built using PHP. The current PHP version is PHP 7.x, encompassing versions 7.2, 7.3, and 7.4.

Versions prior to 7.2 have reached their “end of life” (EOL) and no longer receive security patches. PHP 7.2 will reach EOL on November 30, 2020, potentially becoming a security risk for sites still using it. PHP 7.3 is scheduled to reach EOL on December 6, 2021.

## Publishers Have Until 2022 to Update to PHP 8?

The latest PHP 7.x version, PHP 7.4, reaches EOL on November 8, 2022. This means WordPress publishers technically have two years to upgrade to PHP 8. In practice, most WordPress publishers should be able to update well before this deadline.

## Why WordPress 5.6 is Beta Compatible

WordPress announced that version 5.6, slated for December 2020, should be compatible with PHP 8. However, they noted that undiscovered incompatibilities might still exist. This acknowledges the reality that while the core WordPress installation may work with PHP 8, some issues might remain.

### WordPress 5.6 PHP 8 Guidance:

“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 potential for “undiscovered issues” doesn’t reflect negatively on WordPress 5.6 but is a pragmatic recognition of the complexities in development.

A notable concern is when themes and plugins will become PHP 8 compatible. This factor significantly affects WordPress being considered fully PHP 8 compatible.

### Official WordPress 5.6 Guidance:

“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, “beta” denotes a version that is close to release but may still contain bugs. WordPress 5.6 being “beta-compatible” means it might have undiscovered errors.

Given that themes and plugins might not yet be PHP 8 compatible, it is prudent to delay updating until all have been verified for PHP 8 compliance. Even after this verification, waiting a few more months could be wise, as PHP 8 is a significant update that may reveal bugs and issues in supposedly compatible themes and plugins.

## Will Updating to PHP 8 Break WordPress Sites?

PHP 8 removes many old functions from 7.x, so themes and plugins using these deprecated functions will break. Wordfence estimated that over 5,500 plugins still use functions that are removed in PHP 8, posing potential issues.

### Wordfence Cautions:

“…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 backward compatibility with older versions of PHP. Many plugins, however, will need extensive refactoring as PHP 8 becomes more utilized.”

Yoast also published a study on the PHP 8 readiness of plugins and themes.

## Breaking Changes in PHP 8

### Yoast’s Conclusion on Testing Plugins and Themes:

“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.”

### Yoast Report Conclusion:

“PHP 8 is going to contain a lot of breaking changes.”

“Breaking changes” refer to changes causing errors when a theme or plugin uses code unsupported in PHP 8.

## PHP 8 and WordPress

PHP 8 represents a significant advancement, especially for WordPress users, offering enhanced security. WordPress advises thorough testing before upgrading to PHP 8:

“…it is highly recommended that you thoroughly test your site before upgrading to PHP 8.”

The designation of WordPress 5.6 as “beta-compatible” with PHP 8 is a clear signal of the caution needed for updating.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button