Commit cad9533ca8 for wordpress.org
commit cad9533ca8b6b84d734d58fba3771ef6dbfcb3eb
Author: adamsilverstein <adamsilverstein@git.wordpress.org>
Date: Thu Sep 17 17:22:48 2026 +0000
HTML API: Prevent `set_modifiable_text()` from abruptly closing comments.
Props jeremyfelt, jonsurrell.
Built from https://develop.svn.wordpress.org/trunk@63656
git-svn-id: http://core.svn.wordpress.org/trunk@62830 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 cd5814f0a4..0ad4c293a3 100644
--- a/wp-includes/html-api/class-wp-html-tag-processor.php
+++ b/wp-includes/html-api/class-wp-html-tag-processor.php
@@ -3985,7 +3985,7 @@ class WP_HTML_Tag_Processor {
self::COMMENT_AS_HTML_COMMENT === $this->comment_type
) {
// Check if the text could close the comment.
- if ( 1 === preg_match( '/--!?>/', $plaintext_content ) ) {
+ if ( 1 === preg_match( '/^-?>|--!?>/', $plaintext_content ) ) {
_doing_it_wrong(
__METHOD__,
__( 'Comment text cannot contain a comment closer.' ),
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 2beaef91fa..118762a146 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-63655';
+$wp_version = '7.2-alpha-63656';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.