[wp-trac] [WordPress Trac] #57579: Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in admin-header.php
WordPress Trac
noreply at wordpress.org
Sun Jan 29 22:37:29 UTC 2023
#57579: Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type
string is deprecated in admin-header.php
--------------------------+---------------------
Reporter: ipajen | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.2
Component: General | Version:
Severity: normal | Resolution:
Keywords: PHP81 | Focuses:
--------------------------+---------------------
Changes (by peterwilsoncc):
* component: Plugins => General
* milestone: Awaiting Review => 6.2
Comment:
This is due to a change to `strip_tags` in PHP which started throwing a
warning when `null` is passed to the function, and a fatal error passed
for other values. [https://3v4l.org/qER07 See this example page for how
PHP has changed error handling for the function.]
Folks are currently discussing how to handle this in the helper function
`wp_strip_all_tags()` on the ticket #56434.
As WordPress calls `strip_tags()` directly in a number of cases, on this
ticket let's discuss how to handle the deprecation warning elsewhere.
I see two options:
1. replace most calls to `strip_tags()` with calls to
`wp_strip_all_tags()` -- this is a slight compatibility change as it will
strip the contents of `<style>` and `<script>` tags, but I don't think
that's a bad thing
2. add `wp_strip_tags()` as a wrapper for `strip_tags()` to maintain the
current behavior
FWIW, I think option 1 is preferable as I think that's closer to the
intended use of the function throughout WordPress.
Thanks for the ticket, I've moved it to the 6.2 milestone for visibility
and consideration.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57579#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list