diff --git a/src/wp-includes/html-api/class-wp-html-tag-processor.php b/src/wp-includes/html-api/class-wp-html-tag-processor.php index ede5db8a3d227..7feee0096f3e5 100644 --- a/src/wp-includes/html-api/class-wp-html-tag-processor.php +++ b/src/wp-includes/html-api/class-wp-html-tag-processor.php @@ -291,6 +291,8 @@ * double-quoted strings, meaning that attributes on input with single-quoted or * unquoted values will appear in the output with double-quotes. * + * scripts aren't processed + * * @since 6.2.0 * @since 6.2.1 Fix: Support for various invalid comments; attribute updates are case-insensitive. * @since 6.3.2 Fix: Skip HTML-like content inside rawtext elements such as STYLE. @@ -646,8 +648,8 @@ public function next_tag( $query = null ) { } public function next_token() { - $was_at = $this->bytes_already_parsed; $this->get_updated_html(); + $was_at = $this->bytes_already_parsed; // Don't proceed if there's nothing more to scan. if ( @@ -671,7 +673,7 @@ public function next_token() { // Find the next tag if it exists. if ( false === $this->parse_next_tag() ) { if ( self::STATE_INCOMPLETE === $this->parser_state ) { - $this->bytes_already_parsed = $was_at; + $this->bytes_already_parsed = $was_at; } return false; @@ -687,6 +689,7 @@ public function next_token() { self::STATE_INCOMPLETE === $this->parser_state || $this->bytes_already_parsed >= strlen( $this->html ) ) { + // Does this appropriately clear state (parsed attributes)? $this->parser_state = self::STATE_INCOMPLETE; $this->bytes_already_parsed = $was_at; @@ -713,41 +716,41 @@ public function next_token() { if ( ! $this->is_closing_tag && ( - 'i' === $t || 'I' === $t || - 'n' === $t || 'N' === $t || - 's' === $t || 'S' === $t || - 't' === $t || 'T' === $t || - 'x' === $t || 'X' === $t + 'i' === $t || 'I' === $t || + 'n' === $t || 'N' === $t || + 's' === $t || 'S' === $t || + 't' === $t || 'T' === $t || + 'x' === $t || 'X' === $t ) ) { $tag_name = $this->get_tag(); if ( 'SCRIPT' === $tag_name && ! $this->skip_script_data() ) { - $this->parser_state = self::STATE_INCOMPLETE; - $this->bytes_already_parsed = $was_at; + $this->parser_state = self::STATE_INCOMPLETE; + $this->bytes_already_parsed = $was_at; - return false; + return false; } elseif ( - ( 'TEXTAREA' === $tag_name || 'TITLE' === $tag_name ) && - ! $this->skip_rcdata( $tag_name ) + ( 'TEXTAREA' === $tag_name || 'TITLE' === $tag_name ) && + ! $this->skip_rcdata( $tag_name ) ) { - $this->parser_state = self::STATE_INCOMPLETE; - $this->bytes_already_parsed = $was_at; + $this->parser_state = self::STATE_INCOMPLETE; + $this->bytes_already_parsed = $was_at; - return false; + return false; } elseif ( - ( - 'IFRAME' === $tag_name || - 'NOEMBED' === $tag_name || - 'NOFRAMES' === $tag_name || - 'STYLE' === $tag_name || - 'XMP' === $tag_name - ) && - ! $this->skip_rawtext( $tag_name ) + ( + 'IFRAME' === $tag_name || + 'NOEMBED' === $tag_name || + 'NOFRAMES' === $tag_name || + 'STYLE' === $tag_name || + 'XMP' === $tag_name + ) && + ! $this->skip_rawtext( $tag_name ) ) { - $this->parser_state = self::STATE_INCOMPLETE; - $this->bytes_already_parsed = $was_at; + $this->parser_state = self::STATE_INCOMPLETE; + $this->bytes_already_parsed = $was_at; - return false; + return false; } }