11

Is it related to my server or it is WordPress's error with PHP8.1 and PHP8.2? I see same error for both versions. Should I ignore the errors by setting wp-config.php as:

define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );

This is happening although there is no plugin and no custom theme installed, just plain WordPress 6.1.1

Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice 
/wp-includes/Requests/Cookie/Jar.php on line 63
/wp-includes/Requests/Cookie/Jar.php on line 73
wp-includes/Requests/Cookie/Jar.php on line 89
wp-includes/Requests/Cookie/Jar.php on line 102
wp-includes/Requests/Cookie/Jar.php on line 111


Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in
wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40
2
  • Those are not “errors” but deprecated notices letting you know that functionality is depreciated and might disappear completely in future PHP versions. It is the job of the WordPress developers to address these deprecated notices which I believe they will do in a future WordPress version. And when they do? Just update WordPress and you will no longer see these notices. But again, it is not a real “error.” Just a notice that you, as WordPress end-user, can safely ignore. Commented Jan 29, 2023 at 19:52
  • 1
    They may not be errors but my wp-admin pages were full of those notices, so I saw them as errors. Now I turned them completely off in php.ini for Php8.1 and 8.2.
    – doraemon
    Commented Jan 29, 2023 at 20:52

1 Answer 1

9

This is not actually an error, rather a deprecation notice. Which means, future versions of PHP will remove some old language features, so the developers should be aware of it.

Info. for WordPress:

WordPress developers are well aware of it and future versions of WordPress will be changed and this deprecation notice will no longer appear.

For now, Yes, you may use the following in development environment to suppress the notice (while still being able to debug using the log files):

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );

However, in production, it's safe to turn off WP_DEBUG all together:

define( 'WP_DEBUG', false );

This will suppress all errors in production, so there's no reason to worry about it.

To confirm it further, the following is from WordPress core support ticket:

Excerpt from WordPress support

Info. for PHP:

If you have control of your PHP installation, you may suppress deprecation notices from PHP end as well. This is not recommended in development, but in production you should suppress deprecation notices from PHP end as well.

For example, in php.ini, you may set the following to suppress deprecation notices:

error_reporting = E_ALL ^ E_DEPRECATED
2
  • 2
    There's really no reason why we shouldn't be able to keep full debugging enabled in our dev and QA environments AND expect WordPress core to be free of warnings. They have been really slacking on getting WP PHP 8.1 ready so that we can ensure our plugins and first-party theme code is also fully compatible. Cluttered UX and debug logs or forced debug suppression is not acceptable for proper QA. Commented Feb 15, 2023 at 18:03
  • You are right, this is an unfortunate scenario. I hope it'll be resolved soon enough.
    – Fayaz
    Commented Feb 15, 2023 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.