Opened 2 days ago
Closed 2 days ago
#66483 closed enhancement (fixed)
KSES: Clarify that `valid_unicode()` checks XML Char ranges
| Reported by: | lancewillett | Owned by: | lancewillett |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Formatting | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
valid_unicode() does not check whether a code point is valid Unicode. It follows the XML Char production, so it rejects C0 controls other than tab, line feed and carriage return (for example U+0008 BACKSPACE), along with surrogates and U+FFFE and U+FFFF. Its name and docblock both say "valid Unicode", which invites new callers to use it for the wrong job.
The pull request:
- Rewrites the docblock to say what the function checks, and points callers to the newer Unicode and UTF-8 helpers, such as
wp_is_valid_utf8(). - Adds rejected test cases for U+000B and U+001F. Each one is the only case that fails if the boundary below U+0020 moves.
- Renames the test and its data provider to describe XML
Characceptance.
The function's behavior does not change. Deprecating it is left for a separate ticket.
Follow-up to [64770], which added the test coverage under #65819.
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 65268: