Make WordPress Core

Changeset 58966


Ignore:
Timestamp:
09/02/2024 09:52:34 PM (6 weeks ago)
Author:
dmsnell
Message:

HTML API: Fix logic bug in HTML Processor when opening A element.

A mistake in the original code handling opening A elements in the HTML Processor led to mistakes in parsing where the Processor would bail in situations when it could have proceeded. While this was errant behavior, it didn't violate the public contract since it would bail in these situations.

This patch fixes the mistake, which was to only break out of the innermost loop instead of breaking from the containing loop, which resolves the issue.

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

Follow-up to [56274].

Props jonsurrell.
See #61576.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/html-api/class-wp-html-processor.php

    r58940 r58966  
    23532353                    switch ( $item->node_name ) {
    23542354                        case 'marker':
    2355                             break;
     2355                            break 2;
    23562356
    23572357                        case 'A':
     
    23592359                            $this->state->active_formatting_elements->remove_node( $item );
    23602360                            $this->state->stack_of_open_elements->remove_node( $item );
    2361                             break;
     2361                            break 2;
    23622362                    }
    23632363                }
Note: See TracChangeset for help on using the changeset viewer.