Fix: Bug in _get_wptexturize_split_regex and get_html_split_regex#12403
Fix: Bug in _get_wptexturize_split_regex and get_html_split_regex#12403nickchomey wants to merge 5 commits into
Conversation
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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. |
1fe1f0f to
ef547ab
Compare
ef547ab to
ff4929c
Compare
60bccb3 to
2ab6ba0
Compare
|
I made another commit that modified the regex a bit further |
…r comment re: Shortcode API Roadmap
|
Also took the liberty of addressing a TODO comment in |
There was an error in the regex used in
_get_wptexturize_split_regex()andget_html_split_regex().As shown in the associated trac ticket, if an HTML attribute contained
>, the old regex treated it as the closing>for the element — the pattern[^>]*>simply consumed everything up to the first>character.The new regex
(?:"[^"]*"|'[^']*'|[^>])*+>?places quoted attribute values before the generic character matcher, so"..."and'...'spans are consumed as atomic units - any>inside them is absorbed into the value rather than terminating the tag. The generic[^>]at the end acts as a catch-all for everything else (tag names, unquoted attributes, malformed fragments like<'word), and the possessive*+on the outer group prevents backtracking issues.Trac tickets:
https://core.trac.wordpress.org/ticket/63997
https://core.trac.wordpress.org/ticket/57381
https://core.trac.wordpress.org/ticket/43785
https://core.trac.wordpress.org/ticket/63426
Use of AI Tools
AI assistance: Yes
Tool(s): VSCode Copilot Chat
Model(s): Deepseek V4 Flash
Used for: Diagnosis and implementation of fix. I reviewed and tested it.
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.