Formatting: Strip invalid XML characters in esc_xml()#10698
Formatting: Strip invalid XML characters in esc_xml()#10698himanshupathak95 wants to merge 4 commits intoWordPress:trunkfrom
esc_xml()#10698Conversation
…tions in esc_xml function
|
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. |
Trac ticket: https://core.trac.wordpress.org/ticket/19998
This PR enhances the
esc_xml()function to strip control characters that are not valid according to the XML 1.0 specification. This prevents feed parsers from breaking when encountering invalid characters like vertical tabs, null bytes, and other unprintable control characters in user-supplied content.esc_xml()insrc/wp-includes/formatting.phpto strip invalid XML characters using regex pattern that matches XML 1.0 specblog_charsetis UTF-8 to avoid encoding issues\x09, line feed\x0A, carriage return\x0D)