Brace Your Plugins & Themes For All New PHP 8

PHP 8 would be the next major update that is going to change a lot of things within the WordPress ecosystem. In the previous years, the earlier version releases of PHP didn’t have a heavy impact on the WordPress ecosystem but this could change with the new update of PHP and could majorly affect compatibility.

The good thing about PHP 8 update is that it won’t be having a lot of useless and dysfunctioning features that PHP 7.x had and it will be removed altogether with the new update.

Releasing on 26th November 2020, it would be the biggest update of PHP for our scripting language. But what has this to do with WordPress Plugins and themes?

The Role of WordPress Plugins and Themes

WordPress aims to be compatible with PHP 8 with its upcoming 5.6 release but that doesn’t mean it would be safe to instantly upgrade to PHP 8 with the new release of WordPress 5.6 as WordPress relies on themes and plugins for a blog or a website.

In short, until all the major themes and plugins are compatible with PHP 8, WordPress cannot be considered completely compatible with it.

How Could PHP 8 Affect Your Plugins or Your Themes

Huge Companies like Yoast have been preparing for this for a little while now. 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 in late October.

We highly recommend you to go through the entire report in-depth as it gives an overview of how

PHP 8 update could be having a huge effect on WordPress websites especially the ones with heavy plugins and themes in their system.

The previous versions of PHP i.e. 5.6 to 7 had a simpler migration process but migrating from 7 to 8 was a bit complex and painful. This was a case for WordPress and sites with old codebases along with many WordPress plugins which are on WordPress.

As the makers of essential plugins, we could confirm that. Thus making it necessary for you to either switch to updated plugins or make necessary arrangements.

How can you make arrangements for the upcoming update?

At first, the developers and designers should understand the changes that are happening in PHP 8. We have mentioned certain tools that will help you look for incompatibilities.

  • Run PHP lint on PHP 8 over their code, either via the php -l command (making sure to iterate over all files) or by using PHP Parallel Lint.
  • Run PHPCompatibility over their code: it should be noted that nearly all PHP 8 related sniffs are in the as-of-yet-not-yet-released version 10.0.0 of PHPCompatibility, so people would need to use the develop branch or via Composer dev-develop for the time being, until version 10.0.0 is released. It’s also important to note a considerable test coverage is needed to make this reliable.
  • Run the unit/integration tests for the plugin or theme on PHP 8 and fix anything which comes up as an error.
  • Run the WordPress unit tests and WordPress e2e tests with your plugin activated, and fix any issues that arise.
  • Check the code coverage of the tests and if they are high enough.
  • If you can’t find any tests, manual testing is the only solution especially on the “unhappy paths”, and you should be expecting bug reports.

Final Thoughts

WordPress is officially aiming to be compatible with PHP 8 ready in early December when it releases version 5.6. That means all the plugins and theme developers will have to upgrade their products and make them compatible along with the update and before it’s too late. Check the installed plugins and themes for an efficient and smoother website functioning.