Opened 3 months ago
Closed 3 months ago
#64283 closed defect (bug) (duplicate)
PHP Deprecated: strip_tags(): Passing null to parameter #1 ($string) admin-header.php on line 41
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | minor | Version: | |
| Component: | Administration | Keywords: | |
| Focuses: | administration, php-compatibility | Cc: |
Description
This PHP 8.2 message comes up on most admin mode pages in WP 6.9 RC 2:
[20-Nov-2025 17:58:51 UTC] PHP Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in D:\My Data\Data Files\Web Design\VirtualHosts\mlabeta\wp-admin\admin-header.php on line 41
[20-Nov-2025 17:58:51 UTC] PHP Stack trace:
[20-Nov-2025 17:58:51 UTC] PHP 1. {main}() D:\My Data\Data Files\Web Design\VirtualHosts\mlabeta\wp-admin\upload.php:0
[20-Nov-2025 17:58:51 UTC] PHP 2. require_once() D:\My Data\Data Files\Web Design\VirtualHosts\mlabeta\wp-admin\upload.php:10
[20-Nov-2025 17:58:51 UTC] PHP 3. require_once() D:\My Data\Data Files\Web Design\VirtualHosts\mlabeta\wp-admin\admin.php:244
[20-Nov-2025 17:58:51 UTC] PHP 4. strip_tags($string = NULL) D:\My Data\Data Files\Web Design\VirtualHosts\mlabeta\wp-admin\admin-header.php:41
Change History (2)
#2
@
3 months ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
A null value for $title should indicate that a plugin is doing something wrong because get_admin_page_title() requires a string.
However, #57579 proposed to change strip_tags() to wp_strip_all_tags(), which would convert null to an empty string and silence the error message.
If you have a plugin that uses either null or an empty string as the first parameter of add_submenu_page(), I think that parameter should have been 'options.php' instead (though plugin authors would need to confirm whether it works correctly).
Note: See
TracTickets for help on using
tickets.
Further investigation reveals that this is caused by obsolete code in my plugin, Media Library Assistant. WordPress 5.3 added a position argument to the add_submenu_page() function and my code did not keep up.
In any case, the get_admin_page_title() function can return an empty result and testing for this in admin-header.php would avoid the deprecated message.