Skip to content

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

Closed
sirreal wants to merge 9 commits into
WordPress:trunkfrom
sirreal:html-api-rawtext-ff
Closed

HTML API: Ensure form feed is recognized as close tag name terminator#12936
sirreal wants to merge 9 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: https://core.trac.wordpress.org/ticket/65372

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.

@sirreal
sirreal marked this pull request as ready for review August 10, 2026 09:02
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jonsurrell, westonruter.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@sirreal
sirreal requested review from dmsnell and westonruter August 10, 2026 11:18

@westonruter westonruter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nit suggestions for narrower types.

Comment thread tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
Comment thread tests/phpunit/tests/html-api/wpHtmlTagProcessor.php Outdated
Comment thread tests/phpunit/tests/html-api/wpHtmlTagProcessor.php Outdated
Comment thread tests/phpunit/tests/html-api/wpHtmlTagProcessor.php Outdated
@sirreal

sirreal commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

Merged in r63179.

@sirreal sirreal closed this Aug 11, 2026
@sirreal
sirreal deleted the html-api-rawtext-ff branch August 11, 2026 13:26
pento pushed a commit that referenced this pull request Aug 11, 2026
Form feeds after closing tag names were not recognized, causing complete elements to appear incomplete.

Developed in #12936.

Props jonsurrell, westonruter.
See #65372.


git-svn-id: https://develop.svn.wordpress.org/trunk@63179 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Aug 11, 2026
Form feeds after closing tag names were not recognized, causing complete elements to appear incomplete.

Developed in WordPress/wordpress-develop#12936.

Props jonsurrell, westonruter.
See #65372.

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


git-svn-id: http://core.svn.wordpress.org/trunk@62376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
pento pushed a commit that referenced this pull request Aug 12, 2026
Form feeds after closing tag names were not recognized, causing complete elements to appear incomplete.

Developed in #12936.

Reviewed by bernhard-reiter.
Merges r63179 to the 7.1 branch.

Props jonsurrell, westonruter.
See #65372.


git-svn-id: https://develop.svn.wordpress.org/branches/7.1@63206 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Aug 12, 2026
Form feeds after closing tag names were not recognized, causing complete elements to appear incomplete.

Developed in WordPress/wordpress-develop#12936.

Reviewed by bernhard-reiter.
Merges r63179 to the 7.1 branch.

Props jonsurrell, westonruter.
See #65372.

Built from https://develop.svn.wordpress.org/branches/7.1@63206


git-svn-id: http://core.svn.wordpress.org/branches/7.1@62399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.

2 participants