WordPress PHP 8.1 Support: Not Found

As of 2023-01-03, the latest version of WordPress (6.1.1) still only has “beta support” for PHP 8.0+. PHP 8.1 was released in Nov 2021. 404 days later, full support for PHP 8.1 is still “not found”.

Read more on the Roots blog:


Nice! Didn’t know this :+1:t3:

As someone who likes to stick to the CLI, a shorthand would be:

composer require cweagans/composer-patches rmccue/requests:v1.8.1 && composer config --json extra.patches.rmccue/requests '{"Remove PHP 8.1 deprecation notices": "https://patch-diff.githubusercontent.com/raw/WordPress/Requests/pull/505.diff"}'

There was an important update here, please read at: Patching WordPress Requests for PHP 8.1 | Alexander Goller

Unfortunately at this time I am getting:

Could not apply patch! Skipping. The error was: The process "patch '-p1' --no-backup-if-mismatch -d '/Users/encodia/Sviluppo/www/XYZ/landing.example.it/vendor/rmccue/requests' < '/var/folders/nf/rxrcj1fd74j06wlg3pbvc5600000gn/T/63e5f361afe0a.patch'" exceeded the timeout of 300 seconds.

Still investigating.

1 Like

For those interested: I was able to fix the error using (on my iMac): brew install gpatch

Anyway I am now getting the following errors, so I decided to switch again to PHP 8.0
Could not apply patch! Skipping. The error was: Cannot apply patch https://patch-diff.githubusercontent.com/raw/WordPress/Requests/pull/681.diff

WordPress fighting.

I just wanted to add, an alternative approach is to no-op the deprecated trigger filters as suggested in wp-cli#5623.

We’re using this as a mu-plugin:

 * Plugin Name:  Disable Deprecation Notices
 * Description:  Disable WordPress PHP 8.1+ deprecation notices in non-production environments
 * Version:      1.0.0
 * License:      MIT License

if(env('WP_ENV') !== 'production' && !isset($_REQUEST['_WP_DEPRECATED'])) {
    add_filter( 'deprecated_constructor_trigger_error', '__return_false' );
    add_filter( 'deprecated_function_trigger_error', '__return_false' );
    add_filter( 'deprecated_file_trigger_error', '__return_false' );
    add_filter( 'deprecated_argument_trigger_error', '__return_false' );
    add_filter( 'deprecated_hook_trigger_error', '__return_false' );

You can bypass suppression by setting the URL parameter _WP_DEPRECATED

I might be wrong, but this feels cleaner to me than patching core on deploy or suppressing E_DEPRECATED.


Requests library upgraded to 2.0.5 in WordPress 6.2 – Make WordPress Core :tada: