diff --git a/wp-includes/html-api/class-wp-html-processor.php b/wp-includes/html-api/class-wp-html-processor.php
index b34b2b9baf..14cb296d43 100644
--- a/wp-includes/html-api/class-wp-html-processor.php
+++ b/wp-includes/html-api/class-wp-html-processor.php
@@ -1170,14 +1170,17 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
}
if ( null !== $doctype->public_identifier ) {
- $html .= " PUBLIC \"{$doctype->public_identifier}\"";
+ $quote = str_contains( $doctype->public_identifier, '"' ) ? "'" : '"';
+ $html .= " PUBLIC {$quote}{$doctype->public_identifier}{$quote}";
}
if ( null !== $doctype->system_identifier ) {
if ( null === $doctype->public_identifier ) {
$html .= ' SYSTEM';
}
- $html .= " \"{$doctype->system_identifier}\"";
+ $quote = str_contains( $doctype->system_identifier, '"' ) ? "'" : '"';
+ $html .= " {$quote}{$doctype->system_identifier}{$quote}";
}
+
$html .= '>';
break;
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 61dfd70e2e..68a6d11107 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.7.1-alpha-59404';
+$wp_version = '6.7.1-alpha-59411';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.