Commit 9d0d7c1b18 for wordpress.org

commit 9d0d7c1b187f693feb3d7a60d346ae1433300c7c
Author: jonsurrell <jonsurrell@git.wordpress.org>
Date:   Wed Dec 3 17:27:31 2025 +0000

    HTML API: Ensure correct encoding of modified class names.

    Some class names with HTML character references could be mishandled, for example:
    - Failure to remove an existing class like `&` with `::remove_class( '&' )`
    - Double-encoding of an existing class like `&` after a modification, becoming `&amp;`

    The second case manifested after double-encoding prevention was removed from `::set_attribute()` in [60919].

    Developed in https://github.com/WordPress/wordpress-develop/pull/10591.

    Props jonsurrell, dmsnell.
    Fixes #64340.

    Built from https://develop.svn.wordpress.org/trunk@61346


    git-svn-id: http://core.svn.wordpress.org/trunk@60658 1a063a9b-81f0-0310-95a4-ce76da25c4cd

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 3cdbd91480..31c4bc8a10 100644
--- a/wp-includes/html-api/class-wp-html-tag-processor.php
+++ b/wp-includes/html-api/class-wp-html-tag-processor.php
@@ -2342,10 +2342,12 @@ class WP_HTML_Tag_Processor {
 		}

 		if ( false === $existing_class && isset( $this->attributes['class'] ) ) {
-			$existing_class = substr(
-				$this->html,
-				$this->attributes['class']->value_starts_at,
-				$this->attributes['class']->value_length
+			$existing_class = WP_HTML_Decoder::decode_attribute(
+				substr(
+					$this->html,
+					$this->attributes['class']->value_starts_at,
+					$this->attributes['class']->value_length
+				)
 			);
 		}

diff --git a/wp-includes/version.php b/wp-includes/version.php
index 11978d4d94..bcfed318d0 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.0-alpha-61342';
+$wp_version = '7.0-alpha-61346';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.