Call for testing: PHP 8.0

A long-standing goal of the WordPress project is to be compatible with new versions of PHP on their release day. The next major version of PHP (version 8.0) is currently scheduled for release on November 26, 2020. WordPress Core contributorsCore Contributors Core contributors are those who have worked on a release of WordPress, by creating the functions or finding and patching bugs. These contributions are done through Trac. https://core.trac.wordpress.org. are working to ensure PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 5.6.20 or higher 8.0 is supported in the next major version of WordPress (version 5.6), which is currently scheduled to be released on December 8, 2020.

PHP 8.0 has been in the making for some time and brings a lot of exciting features. But because PHP 8.0 is a major version release, it also includes some backward incompatible changes. Because of this, a great deal of both manual and automated testing is needed in order to ensure the WordPress CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. codebase is ready for PHP 8.0.

Even though WordPress 5.6 will add support for PHP 8.0, no changes will be made to the minimum required version of PHP at this time. Any changes made to provide support for PHP 8.0 will be done in a way that maintains backward compatibility for all versions of PHP supported by WordPress (currently to PHP 5.6.20).

Your help is needed to test WordPress on PHP 8.0! While contributors are working on addressing incompatibilities that can be identified by looking at the PHP release notes and upgrade guides, some issues will need to be found through manually testing.

Timeline for testing

Since changes for PHP 8.0 compatibility may be extensive, November 17, 2020 (the current planned date for 5.6 RC 1) should be seen as the cut off date for the change to be included in WordPress 5.6. To ensure that changes receive proper testing, patches and pull requests should be submitted as soon as possible.

How to test WordPress on PHP 8.0

There are a few ways that you can test WordPress on PHP 8.0. Some more experienced developers may prefer to install PHP 8.0 manually on their own. But below are instructions for what is likely the quickest and easiest way for most contributors to get set up with PHP 8.

Local WordPress Core Docker environment

The WordPress development repository includes the tools needed to easily spin up a local Docker environment for developing WordPress. Here’s how to get started using this method.

  • Make sure Docker is installed on your machine and running.
  • Checkout the development repo using GIT or SVN.
  • Edit the .env file in the clone to change LOCAL_PHP=latest to LOCAL_PHP=8.0-fpm (or run export LOCAL_PHP=8.0-fpm in the command line window you are using). If you like to test locally using the build directory, also change LOCAL_DIR to build (or run export LOCAL_DIR=build).
  • Install NPM dependencies by running npm install.
  • Build WordPress using npm run build:dev (or npm run build if you prefer to test locally using the build directory)
  • Start the Docker environment by running npm run env:start.
  • Install WordPress in the Docker container by running npm run env:install.

You will then be able to access the site at localhost:8889 in your browser. As new development versions of PHP 8 are released (rc2, rc3, etc.), the containers will be updated. To ensure you are running the latest version of the PHP 8 container, you can run npm run env:pull. It is recommended that you do this before starting the container anytime you are testing WordPress on PHP 8.

More information on the local Docker setup for developing WordPress can be found in the initial Make Core blog post.

Ways to test

  • Use WordPress to test default Core functionality.
  • Write new unit tests that confirm specific PHP 8.0 features or breaking changes work (or don’t) as expected.
  • Write new tests for areas of the codebase that does not have sufficient test coverage.
  • Test your favorite plugins and themes for issues.

Reporting issues

If you discover something that you believe to be a PHP 8 compatibility issue, please create a bugbug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority. report on the WordPress Core instance of Trac. Because this is an ongoing effort, it’s possible an issue you have found is already being tracked, is currently being worked on, or has already been fixed. To avoid duplicate reports, please look through pre-existing tickets. The best way to do this is by looking at tickets with the php8 keyword.

Please be sure to provide as many details as you can when creating a ticketticket Created for both bug reports and feature development on the bug tracker. and provide steps that are as specific as possible so that other contributors can quickly and easily reproduce the problem.

More ways to help

  • Head over to the php8 keyword report on WordPress Trac and find a ticket that interests you.
  • Give feedback, write a patchpatch A special text file that describes changes to code, by identifying the files and lines which are added, removed, and altered. It may also be referred to as a diff. A patch can be applied to a codebase for testing., or test a patch!
  • Inform others that help is needed to test WordPress on PHP 8.0.

To ensure changes receive the necessary testing, it’s best to fix PHP 8.0 compatibility issues as early as possible during the WordPress development schedule. The 5.6 RC1 date (November 17th, 2020) should be considered the final cut off for changes. If additional critical PHP 8.0 issues are found during the RC period, they should receive tickets and patches and will be evaluated on a case by case basis. But, they will not be guaranteed to make the 5.6 release (usually, only regressions are addressed during the RC period). 

Thanks in advance for your help preparing WordPress for PHP 8.0!

Props @sergeybiryukov, @daisyo, @desrosj, and @andreamiddleton for proofreading and peer review.

#php, #testing