#56935 closed defect (bug) (worksforme)
Various deprecated warnings with WP 6.0.3 and PHP 8.1
Reported by: | applemango | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.0.3 |
Component: | Upgrade/Install | Keywords: | php81 |
Focuses: | Cc: |
Description (last modified by )
I recently tried updating a WP 6.0.3 install to use PHP 8.1 but I immediately get various deprecated warnings from core code.
For example here's a selection:
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/applhpqm/public_html/wp-includes/formatting.php on line 5385 Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/applhpqm/public_html/wp-includes/pluggable.php on line 599 Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/applhpqm/public_html/wp-includes/formatting.php on line 2772 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 /home/applhpqm/public_html/wp-includes/Requests/Cookie/Jar.php on line 63 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 /home/applhpqm/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40 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 /home/applhpqm/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68 Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /home/applhpqm/public_html/wp-includes/Requests/Transport/cURL.php on line 345
Downgrading to 8.0 suppresses the errors.
Change History (10)
This ticket was mentioned in Slack in #core-test by ironprogrammer. View the logs.
23 months ago
#4
in reply to:
↑ 3
@
21 months ago
Replying to titsmaker:
So I would ask WP devs to prioritize these deprecations
It is worth noting that many of these notices are already resolved in current trunk (6.2-alpha) as part of the work on #54504, #54914, #55656, #55967, #56620, #56681, #56712, and other tickets. I no longer see them on a clean install of 6.2-alpha with PHP 8.2.
This ticket was mentioned in Slack in #core-php by dingo_d. View the logs.
20 months ago
#7
@
14 months ago
@Soean Hey man, I can confirm that the warnings no longer appear! This is awesome and means I can now upgrade my servers to PHP8+. Phew, thank you!
Hi, maybe my posting won't add anything to the discussion, I would gladly add it as a comment somewhere in https://make.wordpress.org/ but the topic has not been discussed since the very beginning of 2022.
So I would ask WP devs to prioritize these deprecations as many people use
even on live sites because testing everything on local machine is often impossible, also that way some edge cases can be revealed. Currently PHP 8.0 is in the very end of it's lifecycle (only security support till November of 2023) and we still can switch to PHP 8.1 as it populate our log with hundreds of such deprecations (mainly in functions.php, formatting.php and different parts of requests library).