mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-08 01:17:59 +01:00
HTML API: Fix normalized doctype pub/sys identifier quotes.
Changeset [59399] fixed missing DOCTYPEs in normalized HTML output. It missed an edge case where public and system identifiers may contain double quotes, in which case they must be quoted with single quotes. This commit addresses that issue and adds tests. Follow-up to [59399]. Reviewed by cbravobernal. Merges [59410] to the 6.7 branch. Props jonsurrell, luisherranz, apermo. Fixes #62396. Built from https://develop.svn.wordpress.org/branches/6.7@59411 git-svn-id: http://core.svn.wordpress.org/branches/6.7@58797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
664c3049d1
commit
3a58544234
@ -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;
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user