Skip to content

Commit 373e362

Browse files
committed
KSES: Deprecate wp_kses_html_error().
`wp_kses_hair()` was updated in WordPress 7.0.0 and was the only place in Core calling `wp_kses_html_error()`. This change deprecates the leftover function and moves it into `deprecated.php`. Developed in: WordPress#13821 Discussed in: https://core.trac.wordpress.org/ticket/63724 Follow-up to r61467. Props dmsnell, westonruter. Fixes #63724. git-svn-id: https://develop.svn.wordpress.org/trunk@64027 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b8d3a98 commit 373e362

2 files changed

Lines changed: 24 additions & 15 deletions

File tree

‎src/wp-includes/deprecated.php‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3843,6 +3843,30 @@ function get_paged_template() {
38433843
return get_query_template( 'paged' );
38443844
}
38453845

3846+
/**
3847+
* Handles parsing errors in `wp_kses_hair()`.
3848+
*
3849+
* The general plan is to remove everything to and including some whitespace,
3850+
* but it deals with quotes and apostrophes as well.
3851+
*
3852+
* Note: This was previously used in certain cases when {@see \wp_kses_hair()}
3853+
* struggled to recognize HTML syntax. Since 7.0.0 when that function was
3854+
* rewritten to rely on the HTML API, those ambiguous situations no longer
3855+
* exist, and this function is no longer relevant.
3856+
*
3857+
* @since 1.0.0
3858+
* @deprecated 7.2.0 This was only meant to be used internally and the calling
3859+
* function has been updated and no-longer needs it.
3860+
*
3861+
* @param string $attr
3862+
* @return string
3863+
*/
3864+
function wp_kses_html_error( $attr ) {
3865+
_deprecated_function( __FUNCTION__, '7.2.0' );
3866+
3867+
return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $attr );
3868+
}
3869+
38463870
/**
38473871
* Removes the HTML JavaScript entities found in early versions of Netscape 4.
38483872
*

‎src/wp-includes/kses.php‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,21 +2068,6 @@ function wp_kses_array_lc( $inarray ) {
20682068
return $outarray;
20692069
}
20702070

2071-
/**
2072-
* Handles parsing errors in `wp_kses_hair()`.
2073-
*
2074-
* The general plan is to remove everything to and including some whitespace,
2075-
* but it deals with quotes and apostrophes as well.
2076-
*
2077-
* @since 1.0.0
2078-
*
2079-
* @param string $attr
2080-
* @return string
2081-
*/
2082-
function wp_kses_html_error( $attr ) {
2083-
return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $attr );
2084-
}
2085-
20862071
/**
20872072
* Sanitizes content from bad protocols and other characters.
20882073
*

0 commit comments

Comments
 (0)