Make WordPress Core

Changeset 63911


Ignore:
Timestamp:
09/24/2026 05:01:36 AM (4 days ago)
Author:
jonsurrell
Message:

Block Processor: Improve comment end search behavior.

Prevent WP_Block_Processor::find_html_comment_end() from repeatedly scanning some spans that cannot contain a comment end.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/13679

Props jonsurrell, dmsnell.
See #66138.

Location:
trunk
Files:
2 edited

Legend:

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

    r63888 r63911  
    13571357                        }
    13581358
    1359                         ++$now_at;
     1359                        $now_at = $closer_must_be_at;
    13601360                }
    13611361
  • trunk/tests/phpunit/tests/block-processor/wpBlockProcessor.php

    r63888 r63911  
    243243         *
    244244         * @ticket 61401
     245         * @ticket 66138
    245246         *
    246247         * @dataProvider data_invalid_block_delimiters_as_html_comments
    … …  
    300301                        'Malformed block name'          => array( '<!-- wp:core/paragraph/variation -->' ),
    301302                        'Invalid block name characters' => array( '<!-- wp:core/32-block -->' ),
     303                        'Dash run'                      => array( '<!--x-----y-->' ),
     304                        'Dash run then bang'            => array( '<!--x---!y-->' ),
     305                        'Bang then dashes'              => array( '<!--x--!-y-->' ),
     306                        'Dash run then bang closer'     => array( '<!--x---!>' ),
     307                        'Bang then dash then closer'    => array( '<!--x--!-->' ),
     308                        'Long dash run'                 => array( '<!--x' . str_repeat( '-', 50000 ) . 'y-->' ),
    302309                );
    303310        }
Note: See TracChangeset for help on using the changeset viewer.