HTML API: Ensure form feed is recognized as close tag name terminator - #12936
Draft
sirreal wants to merge 4 commits into
Draft
HTML API: Ensure form feed is recognized as close tag name terminator#12936sirreal wants to merge 4 commits into
sirreal wants to merge 4 commits into
Conversation
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.
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 throughskip_rcdata()andskip_rawtext(). The Cartesian provider keeps all 49 cases independent and leaves the terminator provider reusable.SCRIPTuses a separate scanner that already handles the full set.Trac ticket: TBD
Testing
WP_TESTS_SKIP_INSTALL=1 vendor/bin/phpunit --group html-apiWP_TESTS_SKIP_INSTALL=1 vendor/bin/phpunit --group=html-api-web-platform-testsvendor/bin/phpcs --standard=phpcs.xml.dist src/wp-includes/html-api/class-wp-html-tag-processor.php tests/phpunit/tests/html-api/wpHtmlTagProcessor.phpgit diff --checkpass.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.