Opened 4 years ago
Last modified 18 months ago
#56433 new defect (bug)
invalid regex used in preg_replace
| Reported by: | chocofc1 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Formatting | Version: | |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: | Focuses: |
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 (3)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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?