Opened 2 years ago
Last modified 2 years ago
#56433 new defect (bug)
invalid regex used in preg_replace
Reported by: | chocofc1 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description (last modified by )
Found in /wp-includes/formatting.php line 5385
$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
I tried this exactly as it is and it does nothing
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hi there, welcome to WordPress Trac! Thanks for the ticket.
That regex is in the
wp_strip_all_tags()
function, and its purpose is to remove all script and style tags from the passed string, including their content.There is a basic unit test for the function to make sure it works as expected, and it passes in the current builds. Introduced in [27042] / #25507.
Could you elaborate a bit more on what is the issue here? Does it still happen with all plugins disabled and a default theme (Twenty Twenty-Two) activated? Could you share the steps to reproduce it on a clean install?