-
Notifications
You must be signed in to change notification settings - Fork 3.1k
HTML API: Replace use of PCRE functions with new UTF-8 pipeline. #9798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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. |
b1b2685 to
0ffcb16
Compare
a8ddba0 to
72fb7da
Compare
f9a9f8f to
d2b7962
Compare
d0ec804 to
1687950
Compare
25e7519 to
b7a3e5e
Compare
f8623e9 to
eea5d1f
Compare
The only PCRE in the HTML API was used to validate a given attribute name when setting an attribute. This change relies on the new UTF-8 `wp_has_noncharacters()` method, removing the reliance on the PCRE extension and unifying behaviors across PHP runtime environments.
eea5d1f to
7f3fea4
Compare
|
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. |
The HTML API has relied upon a single PCRE to determine whether to allow setting certain attribute names. This was because those names aren’t allowed to contain Unicode noncharacters, but detecting noncharacters without a UTF-8 parser is nontrivial. In this change the direct PCRE has been replaced with a number of `strcpn()` calls and a call to the newer `wp_has_noncharacters()` function. Under the hood, this function will still defer to a PCRE if Unicode support is available, but otherwise will fall back to the UTF-8 pipeline in Core. This change removes the platform variability, making the HTML API more reliable when Unicode support for PCRE is lacking. Developed in #9798 Discussed in https://core.trac.wordpress.org/ticket/63863 See #63863. git-svn-id: https://develop.svn.wordpress.org/trunk@61003 602fd350-edb4-49c9-b593-d223f7449a82
The HTML API has relied upon a single PCRE to determine whether to allow setting certain attribute names. This was because those names aren’t allowed to contain Unicode noncharacters, but detecting noncharacters without a UTF-8 parser is nontrivial. In this change the direct PCRE has been replaced with a number of `strcpn()` calls and a call to the newer `wp_has_noncharacters()` function. Under the hood, this function will still defer to a PCRE if Unicode support is available, but otherwise will fall back to the UTF-8 pipeline in Core. This change removes the platform variability, making the HTML API more reliable when Unicode support for PCRE is lacking. Developed in WordPress/wordpress-develop#9798 Discussed in https://core.trac.wordpress.org/ticket/63863 See #63863. Built from https://develop.svn.wordpress.org/trunk@61003 git-svn-id: http://core.svn.wordpress.org/trunk@60339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The HTML API has relied upon a single PCRE to determine whether to allow setting certain attribute names. This was because those names aren’t allowed to contain Unicode noncharacters, but detecting noncharacters without a UTF-8 parser is nontrivial. In this change the direct PCRE has been replaced with a number of `strcpn()` calls and a call to the newer `wp_has_noncharacters()` function. Under the hood, this function will still defer to a PCRE if Unicode support is available, but otherwise will fall back to the UTF-8 pipeline in Core. This change removes the platform variability, making the HTML API more reliable when Unicode support for PCRE is lacking. Developed in WordPress/wordpress-develop#9798 Discussed in https://core.trac.wordpress.org/ticket/63863 See #63863. Built from https://develop.svn.wordpress.org/trunk@61003 git-svn-id: https://core.svn.wordpress.org/trunk@60339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Trac ticket: Core-63863
See:
#9825,#9830,#9498,#9826,#9827, (#9798),#9828,#9829Relies on the new UTF-8 pipeline to eliminate the use of
preg_match()in the HTML API.