WordPress 6.5 PHP Compatibility


As we explained in the previous post, for each new version of WordPress, we aim to release an article explaining the compatibility of PHP with the WordPress versions and our team’s recommendation for that specific version.

On this occasion, once again, we will explain the details of compatibility, including “beta compatible” or “compatible with exceptions”.

So, here you have the compatibility information, this time, for WordPress 6.5.

WordPress’ server requirements

Even if there are more stable software versions, that doesn’t mean they are the ones WordPress recommends.

This makes WordPress 6.5 requirements:

  • PHP: 7.0+
  • MySQL: 5.5.5+
  • MariaDB: 5.5.5+

You can read more at Server requirements.

WordPress’ compatibility “at the time”

WordPress 6.5 was released on April 2, 2024, and at that time we had the following components available (stable or security-maintained versions only, and RC only for informational purposes).

  • PHP: 8.1, 8.2, and 8.3
  • MySQL: 8.0 (LTS), 8.2, and 8.3.
  • MariaDB: 10.4 (LTS), 10.5 (LTS), 10.6 (LTS), 10.11 (LTS), 11.0, 11.1, 11.2, and 11.3

You can read more at WordPress Compatibility.

WordPress and PHP

PHP is a programming language on which WordPress code is based. This language runs on the server, and it is critical to keep it up to date, both for security and functionality.

WordPress supports many versions of PHP, some even obsolete (PHP Compatibility and WordPress Versions).

WordPress 6.5 (core) is:

  • fully compatible with PHP 7.01, 7.11, 7.21, 7.31, and 7.41.
  • compatible with exceptions with PHP 8.01, 8.1, and 8.2.
  • beta compatible with 8.3.

1 SECURITY ALERT: These versions are not officially maintained by PHP, so they are considered insecure and obsolete versions and should not be used in production. Check with your hosting provider about the security maintenance they can do.

What “compatible with exceptions” mean?

PHP 8.0

  • Named parameters. WordPress does not support named parameters.
    PHP 8.0 supports optionally calling functions and class methods by specifying the parameter name, instead of calling them on the order of parameters that they are declared.
    PHP, and many other programming languages, support positional parameters: The caller passes the parameters in the same order the function/method declares its parameters.
  • Filesystem WP_Filesystem_FTPext and WP_Filesystem_SSH2 when connect fails.
    An investigation is underway as to why on some occasions the access to the files returns some type of error.

PHP 8.1

  • Not all “passing null to non-nullable” issues have been found.
    In PHP, you can tell a function exactly what type of information it should accept. If you tell a function to expect a certain type of information, and you give it nothing at all (null is like saying “nothing”), then PHP gets confused and gives an error. This problem happens when someone accidentally gives a function “nothing” when the function wasn’t designed to handle “nothing”.
  • htmlentities() et al needs the default value of the flags parameter explicitly set.
    According to htmlentities(), the default for flags for PHP 8.1 was “changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401”. All use cases for this functionality in WordPress Core are being investigated.
  • Replace most strip_tags() with wp_strip_tags().
    There are rare occasions when the strip_tags() function is passed a null value, which generates a warning that the string is deprecated.

PHP 8.2

What “beta” mean?

PHP 8.3

  • Deprecation notices
    A deprecation notice is not an error, but rather an indicator of where additional work is needed for compatibility before PHP 9.0. With a deprecation notice, the PHP code will continue to work and nothing is broken.

Hosting Team Recommendation

Taking all this into account, the Hosting Team’s recommendations for WordPress 6.5 are as follows (which may differ from the global ones).

  • PHP: 8.2.x
  • MySQL: 8.0.x
  • MariaDB: 10.11.x

IMPORTANT: These recommendations are intended, primarily, for new installations by hosting providers.

Props: @luciaalcantara

#core, #php