Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2154,6 +2154,14 @@ module.exports = function(grunt) {
];
} )
) );

grunt.log.writeln(
'Found ' + routeNames.length + ' route' + ( routeNames.length === 1 ? '' : 's' ) +
' registered in ' + registryPath + ':'
);
routeNames.forEach( function( name ) {
grunt.log.writeln( ' - ' + name );
} );
} );

grunt.registerTask( 'build:gutenberg', [
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,7 @@ public function serialize_token(): string {

case 'SCRIPT':
case 'STYLE':
case 'XMP':
break;

default:
Expand Down
1 change: 0 additions & 1 deletion src/wp-includes/html-api/class-wp-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,6 @@ private function skip_script_data(): bool {
( 'p' === $html[ $at + 4 ] || 'P' === $html[ $at + 4 ] ) &&
( 't' === $html[ $at + 5 ] || 'T' === $html[ $at + 5 ] )
) ) {
++$at;
continue;
}

Expand Down
14 changes: 14 additions & 0 deletions tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,19 @@ public function test_style_contents_are_not_escaped() {
);
}

/**
* Ensures that XMP contents are not escaped, as they are not parsed like text nodes are.
*
* @ticket 62036
*/
public function test_xmp_contents_are_not_escaped() {
$this->assertSame(
WP_HTML_Processor::normalize( "<xmp>apples > or\x00anges & pears < plums</xmp>" ),
"<xmp>apples > or\u{FFFD}anges & pears < plums</xmp>",
'Should have preserved text inside an XMP element, except for replacing NULL bytes.'
);
}

public function test_unexpected_closing_tags_are_removed() {
$this->assertSame(
WP_HTML_Processor::normalize( 'one</div>two</span>three' ),
Expand Down Expand Up @@ -616,6 +629,7 @@ public static function data_provider_normalized_fuzzer_cases_that_should_be_idem
'FORM with SVG TITLE text edge' => array( "<form ><svg ><title \"'></form><form>" ),
'FORM with TABLE and SCRIPT' => array( '<form id><table te"><script></script><td srce" ID/></form><form claslicate">' ),
'FORM with TABLE CAPTION' => array( '<form><table><caption></form><form >' ),
'XMP rawtext with entity-looking text' => array( '<xmp>apples > oranges &amp; <</xmp>' ),
'Short malformed G attribute C' => array( '<g c/=>' ),
'Short malformed G attribute S' => array( '<g s/=>' ),
'Duplicate SRC boundary' => array( '<g src=""g src="">' ),
Expand Down
2 changes: 2 additions & 0 deletions tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,8 @@ public static function data_script_tag(): Generator {
yield 'Script tag with </script\f> close' => array( "<script></script\f>", true );
yield 'Script tag with </script\r> close' => array( "<script></script\r>", true );
yield 'Script with type attribute' => array( '<script type="text/javascript"></script>', true );
yield 'Script text less-than' => array( '<script><</script>', true );
yield 'Script text less-than solidus' => array( '<script></</script>', true );
yield 'Script data escaped' => array( '<script><!--</script>', true );
yield 'Script data double-escaped exit (comment)' => array( '<script><!--<script>--></script>', true );
yield 'Script data double-escaped exit (closed ">")' => array( '<script><!--<script></script></script>', true );
Expand Down
Loading