[wp-trac] [WordPress Trac] #64574: Regression in `wp.sanitize.stripTags()` in WordPress 7.0-alpha
WordPress Trac
noreply at wordpress.org
Fri Jan 30 14:54:39 UTC 2026
#64574: Regression in `wp.sanitize.stripTags()` in WordPress 7.0-alpha
--------------------------+-----------------------------
Reporter: hugod | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: javascript |
--------------------------+-----------------------------
`wp.sanitize.stripTags()` doesn't return the same value when given `null`.
With WordPress 6.9:
{{{
console.log( 'testStripTagsWithNull', wp.sanitize.stripTags( null ) ); //
""
console.log( 'typeofResult', typeof wp.sanitize.stripTags( null ) ); //
string
}}}
With WordPress 7.0-alpha:
{{{
console.log( 'testStripTagsWithNull', wp.sanitize.stripTags( null ) ); //
"null"
console.log( 'typeofResult', typeof wp.sanitize.stripTags( null ) ); //
string
}}}
Leading to unexpected behavior in `wp.sanitize.stripTagsAndEncodeText()`
as well...
I think the regression has been introduced in https://github.com/WordPress
/wordpress-develop/commit/3865859fd8982575204bc04e77197ea4c743ccf5.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64574>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list