Compare commits

...

2 Commits

Author SHA1 Message Date
Bernhard Reiter a3f1555919 Block Hooks: Fix `@since` and deprecated versions.
Two `@since` PHPDoc fields, and the version argument to one `_deprecated_argument()` incorrectly stated 6.5.1 as the relevant WordPress version where a change was introduced.

This changeset fixes them by setting them to 6.5.3 instead.

Follow-up to [57919].
See #60754.
Built from https://develop.svn.wordpress.org/trunk@58042


git-svn-id: http://core.svn.wordpress.org/trunk@57508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-24 12:11:15 +00:00
dmsnell f9776f536f HTML API: Fix detection of single-length funky comments.
Since [60428] the Tag Processor has been misidentifying single-character
funky comments. It has been asserting that the full token-length for a
funky comment must be at least three characters after the opening (e.g.
`</1>`), but it has been starting to look for the closing `>` after
those same three characters. This means that it has been skipping the
actual close of these funky comments and swallowing up the next syntax
until it finds a `>`, often consuming the next tag in the process.

This patch fixes the detector and restores finding the following token.

Developed in https://github.com/WordPress/wordpress-develop/pull/6412
Discussed in https://core.trac.wordpress.org/ticket/60170

Follow-up to [60428].
Fixes #60170.
Props dmsnell, gziolo, jonsurrell.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-24 07:45:14 +00:00
3 changed files with 12 additions and 6 deletions

View File

@ -729,7 +729,7 @@ function _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy,
* It is self-sufficient in that it only uses information passed as arguments; it does not
* query the database for additional information.
*
* @since 6.5.1
* @since 6.5.3
* @access private
*
* @param WP_Post $post Template post.
@ -1505,7 +1505,7 @@ function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '
*/
function inject_ignored_hooked_blocks_metadata_attributes( $changes, $deprecated = null ) {
if ( null !== $deprecated ) {
_deprecated_argument( __FUNCTION__, '6.5.1' );
_deprecated_argument( __FUNCTION__, '6.5.3' );
}
$hooked_blocks = get_hooked_blocks();

View File

@ -1629,7 +1629,7 @@ class WP_HTML_Tag_Processor {
* `<!` transitions to markup declaration open state
* https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
*/
if ( '!' === $html[ $at + 1 ] ) {
if ( ! $this->is_closing_tag && '!' === $html[ $at + 1 ] ) {
/*
* `<!--` transitions to a comment state apply further comment rules.
* https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
@ -1809,6 +1809,12 @@ class WP_HTML_Tag_Processor {
* See https://html.spec.whatwg.org/#parse-error-missing-end-tag-name
*/
if ( '>' === $html[ $at + 1 ] ) {
// `<>` is interpreted as plaintext.
if ( ! $this->is_closing_tag ) {
++$at;
continue;
}
$this->parser_state = self::STATE_PRESUMPTUOUS_TAG;
$this->token_length = $at + 2 - $this->token_starts_at;
$this->bytes_already_parsed = $at + 2;
@ -1819,7 +1825,7 @@ class WP_HTML_Tag_Processor {
* `<?` transitions to a bogus comment state skip to the nearest >
* See https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
*/
if ( '?' === $html[ $at + 1 ] ) {
if ( ! $this->is_closing_tag && '?' === $html[ $at + 1 ] ) {
$closer_at = strpos( $html, '>', $at + 2 );
if ( false === $closer_at ) {
$this->parser_state = self::STATE_INCOMPLETE_INPUT;
@ -1891,7 +1897,7 @@ class WP_HTML_Tag_Processor {
return false;
}
$closer_at = strpos( $html, '>', $at + 3 );
$closer_at = strpos( $html, '>', $at + 2 );
if ( false === $closer_at ) {
$this->parser_state = self::STATE_INCOMPLETE_INPUT;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.6-alpha-58039';
$wp_version = '6.6-alpha-58042';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.