Skip to content

Conversation

kraftbj
Copy link

@kraftbj kraftbj commented Aug 20, 2025

Adds handling of non-string values passed to the WP_HTML_Tag_Processor by throwing a _doing_it_wrong and setting it to an empty string to avoid further issues.

Trac ticket: https://core.trac.wordpress.org/ticket/63854


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.

Copy link

github-actions bot commented Aug 20, 2025

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 kraftbj, jonsurrell, westonruter.

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

Copy link

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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • 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.

kraftbj and others added 2 commits August 22, 2025 12:31
Co-authored-by: Jon Surrell <sirreal@users.noreply.github.com>
@kraftbj kraftbj requested a review from sirreal August 22, 2025 17:34
@sirreal
Copy link
Member

sirreal commented Aug 26, 2025

I think ‎WP_HTML_Processor::create_fragment() and WP_HTML_Processor::create_full_parser() are also susceptible. Those can also _doing_it_wrong(), but they're simpler in that they can return null. Do you mind adding those changes here?

@sirreal
Copy link
Member

sirreal commented Sep 30, 2025

@kraftbj Just checking in, I'd love to get this in 6.9. Are you able to get back to it or would you like help to finish up?

@kraftbj
Copy link
Author

kraftbj commented Sep 30, 2025

Apologies—death in the family after the last comment and it fell off my radar. I'll refresh the branch and make the updates to the other functions now.

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

Looks good!

This makes it easier to run the HTML API tests in isolation without
the entire phpunit configuration.
Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

Thank you! I added tests for the HTML processor.

This is ready to go 👍

pento pushed a commit that referenced this pull request Oct 1, 2025
Prevents an issue where passing `null` to HTML API constructors could result in runtime errors.

Developed in #9545.

Props kraftbj, jonsurrell, westonruter.
Fixes #63854.


git-svn-id: https://develop.svn.wordpress.org/trunk@60887 602fd350-edb4-49c9-b593-d223f7449a82
Copy link

github-actions bot commented Oct 1, 2025

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 60887
GitHub commit: 055010b

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Oct 1, 2025
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Oct 1, 2025
Prevents an issue where passing `null` to HTML API constructors could result in runtime errors.

Developed in WordPress/wordpress-develop#9545.

Props kraftbj, jonsurrell, westonruter.
Fixes #63854.

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


git-svn-id: http://core.svn.wordpress.org/trunk@60223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
github-actions bot pushed a commit to platformsh/wordpress-performance that referenced this pull request Oct 1, 2025
Prevents an issue where passing `null` to HTML API constructors could result in runtime errors.

Developed in WordPress/wordpress-develop#9545.

Props kraftbj, jonsurrell, westonruter.
Fixes #63854.

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


git-svn-id: https://core.svn.wordpress.org/trunk@60223 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.

3 participants