diff --git a/wp-includes/html-api/class-wp-html-tag-processor.php b/wp-includes/html-api/class-wp-html-tag-processor.php
index 95216b08a1..11a0daa4b2 100644
--- a/wp-includes/html-api/class-wp-html-tag-processor.php
+++ b/wp-includes/html-api/class-wp-html-tag-processor.php
@@ -4009,7 +4009,13 @@ class WP_HTML_Tag_Processor {
}
// Does the tag name match the requested tag name in a case-insensitive manner?
- if ( isset( $this->sought_tag_name ) && 0 !== substr_compare( $this->html, $this->sought_tag_name, $this->tag_name_starts_at, $this->tag_name_length, true ) ) {
+ if (
+ isset( $this->sought_tag_name ) &&
+ (
+ strlen( $this->sought_tag_name ) !== $this->tag_name_length ||
+ 0 !== substr_compare( $this->html, $this->sought_tag_name, $this->tag_name_starts_at, $this->tag_name_length, true )
+ )
+ ) {
return false;
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index db48760018..aca0814450 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.7-alpha-58892';
+$wp_version = '6.7-alpha-58893';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.