[wp-trac] [WordPress Trac] #57579: Replace most strip_tags() with wp_strip_all_tags()
WordPress Trac
noreply at wordpress.org
Wed Mar 5 14:47:01 UTC 2025
#57579: Replace most strip_tags() with wp_strip_all_tags()
-------------------------------------------------+-------------------------
Reporter: ipajen | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future
| Release
Component: General | Version:
Severity: normal | Resolution:
Keywords: php81 has-patch changes-requested | Focuses: php-
needs-unit-tests | compatibility
-------------------------------------------------+-------------------------
Comment (by johnbillion):
Replying to [comment:22 joemcgill]:
> Given that error handling has been handled in `wp_strip_all_tags` in
#56434
That's true for non-scalar values, but a `null` value doesn't trigger an
error, [https://github.com/WordPress/wordpress-
develop/blob/e641b06f0f216030097a5621eb36e59041e09055/src/wp-
includes/formatting.php#L5509-L5511 an empty string is just returned
instead].
I would prefer not to introduce further places where a value of an
unexpected type is silently ignored, which is what would happen if
instances of `strip_tags()` are changed to `wp_strip_all_tags()` and a
value of `null` is passed. If this change is made, I think a value of
`null` needs to trigger a warning, either natively by PHP or via
`wp_trigger_error()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57579#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list