Skip to content

Commit aa51e50

Browse files
committed
KSES: Early-abort in wp_kses_hair() when no attributes exist.
When `wp_kses_hair()` calls into the HTML API to parse an attribute string, it checks if the result might be `null` and returns early, skipping a few minor operations. It could also skip when the returned attribute count is zero. This patch adds the additional check and early-return. Developed in: WordPress#10764 Discussed in: https://core.trac.wordpress.org/ticket/63724 Follow-up to [61499]. Props dd32, dmsnell, jonsurrell. See #63724. git-svn-id: https://develop.svn.wordpress.org/trunk@61503 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 73d7a6d commit aa51e50

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/wp-includes/kses.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ function wp_kses_hair( $attr, $allowed_protocols ) {
16241624
$processor->next_token();
16251625

16261626
$attribute_names = $processor->get_attribute_names_with_prefix( '' );
1627-
if ( ! isset( $attribute_names ) ) {
1627+
if ( null === $attribute_names || 0 === count( $attribute_names ) ) {
16281628
return $attributes;
16291629
}
16301630

0 commit comments

Comments
 (0)