Deprecation warnings PHP 8.1
-
When I activate the plugin with my local setup running PHP 8.1, then I get a whole bunch of these deprecation warnings:
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 in /app/wordpress/wp-includes/Requests/Cookie/Jar.php on line 63Not a major issue, just thought I should report it!
-
Cookies aren’t used in this plugin. Is there a stack trace?
Sadly no stack trace. Ya I didn’t think there would be cookies, so it is odd it chucks these warnings right? The only plugin active is this one. I triple checked. π If I switch back to PHP 8.0, all is good.
The entire warning message, which appears on the
/wp-admin/plugins.phppage and on the plugin settings page (/wp-admin/tools.php?page=wp-beta-tester) is: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 in /app/wordpress/wp-includes/Requests/Cookie/Jar.php on line 63 Deprecated: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/wordpress/wp-includes/Requests/Cookie/Jar.php on line 73 Deprecated: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/wordpress/wp-includes/Requests/Cookie/Jar.php on line 89 Deprecated: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/wordpress/wp-includes/Requests/Cookie/Jar.php on line 102 Deprecated: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/wordpress/wp-includes/Requests/Cookie/Jar.php on line 111 Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /app/wordpress/wp-includes/Requests/Transport/cURL.php on line 345 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 /app/wordpress/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40 Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/wordpress/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 51 Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/wordpress/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68 Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/wordpress/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 82 Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/wordpress/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 91I’ve tracked this down to an error in
wp-includes/option.php::wp_user_settings() line 1089which returns empty. This is later passed tosetCookie()where the error triggers.-
This reply was modified 3 years, 6 months ago by
Andy Fragen.
This seems to have been fixed for WP 6.1, https://core.trac.wordpress.org/changeset/53490
Nice find! I tried to track down the PHP 8.1 fixes in WP 6.1 core, but didn’t come across this one. The odd thing is I’ve been running WP 6.1-beta2, so perhaps it’s not merged yet? I can’t tell. It’s not obvious to me like it is with git. π
However the deprecated notices persist until core figures them out. Can set WP_DEBUG to false and the notices won’t appear. Sorry, that’s the best I’ve got.
-
This reply was modified 3 years, 6 months ago by
The topic ‘Deprecation warnings PHP 8.1’ is closed to new replies.