Make WordPress Core


Ignore:
Timestamp:
08/06/2024 08:41:58 PM (22 months ago)
Author:
dmsnell
Message:

HTML API: Truncated funky comments should cause the Tag Processor to pause.

A state change was missing in the Tag Processor when the input is too short to
find a comment closer after an opened funky comment. This patch fixes a issue
where </# does not correctly report incomplete input, but </# does.

Developed in https://github.com/wordpress/wordpress-develop/pull/7146
Discussed in https://core.trac.wordpress.org/ticket/61831

Props: jonsurrell.
Fixes #61831.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php

    r58845 r58858  
    29042904        $this->assertTrue( $processor->paused_at_incomplete_token() );
    29052905    }
     2906
     2907    /**
     2908     * Test a bugfix where the input ends abruptly with a funky comment started.
     2909     *
     2910     * @ticket 61831
     2911     */
     2912    public function test_unclosed_funky_comment_input_too_short() {
     2913        $processor = new WP_HTML_Tag_Processor( '</#' );
     2914        $this->assertFalse( $processor->next_tag() );
     2915        $this->assertTrue( $processor->paused_at_incomplete_token() );
     2916    }
    29062917}
Note: See TracChangeset for help on using the changeset viewer.