#60982 closed defect (bug) (duplicate)
warnings with php 8.1
Reported by: | yus0 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | php81 |
Focuses: | Cc: |
Description (last modified by )
With php v8.1 and WordPress v6.5.2 I receive warnings in admin area:
PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /wp-includes/functions.php on line 7241
PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /wp-includes/functions.php on line 2187
PHP Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in \wp-admin\admin-header.php on line 36
They all are easily fixable, so I just hope somebody will add fixes to next update:
https://prnt.sc/SXP6CYRUswtz
https://prnt.sc/-XgEBobeohgn
https://prnt.sc/GiNK_lL4cwxX
Change History (3)
#2
@
6 months ago
- Resolution set to invalid
- Status changed from new to closed
I backtraced warnings, all of them are caused by passing null as $parent_slug into the "add_submenu_page" function. It didn't caused any warnings for years, now it treated by replacing null value with a single space character (empty string still causes warnings because of "get_admin_page_title" returns null).
You are right that suggested changes just hides the problem, that can cause critical errors after adding types declaration for fuctions parameters (I hope it will be done soon or late).
#3
@
6 months ago
- Description modified (diff)
- Keywords reporter-feedback removed
- Milestone Awaiting Review deleted
- Resolution changed from invalid to duplicate
#57580 is also about null
parameter(s) in the add_submenu_page
function.
(My first patch there could have silenced errors too, but plugin authors need to know that null
does not work well.)
@yus0 thank you for your interest in contributing to WordPress.
These warnings need a backtrace to see where they are originate from. In the fast majority of cases, these are caused by plugins passing an incorrect data type to a WP function.
The fixes you propose are incorrect as they hide the errors instead of fixing them in the function calls which are actually causing them.
Suggest: close unless the reporter provides details showing these deprecations can be traced back to function calls within WordPress itself.