Make WordPress Core

Opened 4 weeks ago

Last modified 8 days ago

#61072 new enhancement

HTML API: Add custom text decoder

Reported by: dmsnell's profile dmsnell Owned by:
Milestone: 6.6 Priority: normal
Severity: normal Version: trunk
Component: HTML API Keywords: has-patch
Focuses: Cc:

Description

Provide a custom decoder for strings coming from HTML attributes and
markup. This custom decoder is necessary because of deficiencies in
PHP's html_entity_decode() function:

  • It isn't aware of 720 of the possible named character references in HTML, leaving many out that should be translated.
  • It isn't aware of the ambiguous ampersand rule, which allows conversion of character references in certain contexts when they are missing their closing ;.
  • It doesn't draw a distinction for the ambiguous ampersand rule when decoding attribute values instead of markup values.

This decoder will also provide some conveniences, such as making a
single-pass and interruptable decode operation possible. This will
provide a number of opportunities to optimize detection and decoding
of things like value prefixes, and whether a value contains a given
substring.

Change History (2)

#1 @dmsnell
3 weeks ago

  • Milestone changed from Awaiting Review to 6.6

I'm not sure why the PR isn't auto-linking: https://github.com/WordPress/wordpress-develop/pull/6387

This ticket was mentioned in Slack in #core-performance by dmsnell. View the logs.


8 days ago

Note: See TracTickets for help on using tickets.