Skip to content

HTML API: Ensure form feed is recognized as close tag name terminator - #12936

Draft
sirreal wants to merge 4 commits into
WordPress:trunkfrom
sirreal:html-api-rawtext-ff
Draft

HTML API: Ensure form feed is recognized as close tag name terminator#12936
sirreal wants to merge 4 commits into
WordPress:trunkfrom
sirreal:html-api-rawtext-ff

Conversation

@sirreal

@sirreal sirreal commented Aug 7, 2026

Copy link
Copy Markdown
Member

WP_HTML_Tag_Processor::skip_rcdata() omits U+000C FORM FEED from the end-tag-name terminator set. A valid closer such as </xmp\f> is treated as text, and the processor reports the complete XMP element as incomplete. The same broken scanner handles six other RCDATA and RAWTEXT elements.

Add FORM FEED to the predicate. Test the complete terminator contract — space, tab, LF, FF, CR, /, and > — against every element routed through skip_rcdata() and skip_rawtext(). The Cartesian provider keeps all 49 cases independent and leaves the terminator provider reusable. SCRIPT uses a separate scanner that already handles the full set.

Trac ticket: TBD

Testing

  • WP_TESTS_SKIP_INSTALL=1 vendor/bin/phpunit --group html-api
    • 1,714 tests, 6,107 assertions, 1 skipped.
  • WP_TESTS_SKIP_INSTALL=1 vendor/bin/phpunit --group=html-api-web-platform-tests
    • 1,707 tests, 1,261 assertions, 446 skipped.
  • vendor/bin/phpcs --standard=phpcs.xml.dist src/wp-includes/html-api/class-wp-html-tag-processor.php tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
  • PHP syntax and git diff --check pass.

Use of AI Tools

AI assistance: Yes
Tool(s): OpenAI Codex
Model(s): GPT-5
Used for: Reproducing the defect, auditing related tokenizer paths, implementing the fix and tests, adversarial review, and drafting this description. The contributor reviewed the final changes and test results.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

sirreal added 4 commits August 7, 2026 15:47
Form feed is ASCII whitespace. It terminates an appropriate RCDATA or RAWTEXT end tag name, but skip_rcdata() rejects it and leaves the entire special element incomplete.

Cover every element routed through that scanner. SCRIPT uses a separate scanner and already has this coverage.
skip_rcdata() omits form feed from the tag-name terminator set even though it is ASCII whitespace. Valid RCDATA and RAWTEXT closers then look like text, so the processor pauses on a complete element.

Accept form feed before handing the closer to the existing attribute scanner.
The test and provider leave their return contracts partly implicit. State void and the exact generator key and value shape so static analysis does not have to guess.
The regression test names only form feed, but skip_rcdata() implements a seven-character boundary contract. Testing one byte leaves the other accepted paths free to drift.

Keep the terminators in a reusable provider and run the full Cartesian matrix as independent cases.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant