The release of PHP version 8 in November was always going to be a special day for PHP developers around the world as the much-anticipated release of PHP version 8 came to fruition. To many developers, this major release marked an improvement of security and error handling in PHP, problems that have persisted in the platform for a very long time.
How we got to the current version 8
To understand how we got to PHP version 8, it is important to note that every PHP version has a 2-year life cycle during which it is improved, bugs are fixed and users are able to migrate to the new version. After that, the version is supported for one more year where the version security issues are fixed. At the end of its third year, the version comes to its ‘End of Life’ (EoL) and users are urged to move to a new version. This is what is expected of the previous PHP version, PHP 7.4, which was launched last year in November.
Support and bug fixes for PHP version 7.4 is expected to end in November 2021, when its two-year lifecycle comes to an end. However, security fixes will still be made on the version and the support is expected to end in November 2022, when it is expected that everyone will have migrated to PHP version 8.
What’s next for WordPress users
WordPress platform runs on PHP and the latest release of PHP 8 means that users of WordPress should start considering how to migrate to the new version of PHP. Therefore, the timing of when to migrate to the new platform has become important to these users, as they weigh the risks involved in migrating to the new versions.
The good news is, WordPress users have until November 2022 to upgrade to PHP version 8, when it is expected that the support for PHP version 7.4 will cease.
WordPress new version
The release of PHP version 8 is the reason that, in the past few months, WordPress has been working on upgrading its platform to be PHP version 8 compatible. An announcement on the future of WordPress indicated that a new version of WordPress would be released on December 8th that would be compatible with the newly released PHP version 8.
Users looking to upgrade to the new WordPress version, however, were reminded that the release was beta and might experience some problems. Compatibility issues with themes and plugins were also brought to attention and their impact analyzed on how they would impact users who were looking to migrate to the new platform.
Beta versions are released before more stable versions with long term support are released. Therefore, upgrading your site to the beta version may cause problems because it has not been fully tested to ensure that it is a hundred percent compatible.
Upgrading the core WordPress version will also mean that all the plugins and themes running on the website need to be up to date and also compatible with PHP 8. However, research by Yoast on the compatibility of themes and plugins with PHP 8 found that the process might not run smoothly and may lead to the site breaking down, especially for large projects.
Upgrades of security features in PHP 8 will also result in your site breaking down if all the plugins and themes are not compatible with the PHP version. For instance, PHP 8 has become stricter in the way it handles errors. Issues that resulted in notices in PHP 7 are now flagged as warnings in PHP 8 and issues that were being flagged as warnings in the previous versions of PHP are now being flagged as errors. Previous versions of PHP were able to run even though they threw notices and warnings. However, with the new versions, these notices and warnings will be upgraded to more serious issues, which will result in sections of your code not running, therefore, breaking your code.
Type juggling in PHP 8, where users were able to use numbers and strings the same way, has also been eliminated. This common feature in previous versions will also result in errors and therefore, it is important to make sure your WordPress site, plugins and themes are PHP compatible.
PHP 8 has removed a lot of major functions that were commonly used in previous PHP versions. Functions such as create_function() and each() function, which have been removed in PHP 8, are still being used in thousands of plugins and themes. Updating the core WordPress version to version 5.6, which is compatible with PHP 8, without considering such functions and plugins that currently use them will mean that their usage will become redundant, breaking the site.
For large projects that are already live, therefore, it is highly recommended that WordPress users become patient and wait until a stable version of the platform is released. This will help in preventing the site from breaking and creating problems.
In the case that you must migrate your site and upgrade to PHP 8, ensure that you create a backup to your site. This will ensure that you have a fallback plan if things don’t go your way.
It is also recommended that you test the new site once the WordPress 5.6 beta version is released. This can be done through a new installation of the platform and will help you familiarize yourself with the platform before the stable version is released.