Make WordPress Core

Changeset 60768 for trunk/phpcs.xml.dist


Ignore:
Timestamp:
09/16/2025 12:35:01 PM (8 months ago)
Author:
dmsnell
Message:

Charset: Introduce UTF-8 scanning pipeline.

This is the third in a series of patches to modernize and standardize UTF-8 handling.

When the fallback UTF-8 validation code was added it was placed inside formatting.php; however, that validation logic can be reused for a number of related UTF-8 functions. To faciliate this it was moved into a new location and loaded early. This patch is follow-up to that first half, whereby the UTF-8 scanning logic forms its own new _wp_scan_utf8() function. This new UTF-8 scanner is a low-level function which forms a shared spec-compliant processing core to power multiple fallback functions and some new functionality as well.

Developed in https://github.com/WordPress/wordpress-develop/pull/9830
Discussed in https://core.trac.wordpress.org/ticket/63863

Follow-up to: [60743].

See #63863.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpcs.xml.dist

    r58925 r60768  
    256256    </rule>
    257257
    258     <!-- Exclude forbidding goto in the HTML Processor, which mimics algorithms that are written
    259          this way in the HTML specification, and these particular algorithms are complex and
    260          highly imperative. Avoiding the goto introduces a number of risks that could make it
    261          more difficult to maintain the relationship to the standard, lead to subtle differences
    262          in the parsing, and distance the code from its standard. -->
    263258    <rule ref="Generic.PHP.DiscourageGoto.Found">
     259        <!-- Exclude forbidding goto in the HTML Processor, which mimics algorithms that are written
     260             this way in the HTML specification, and these particular algorithms are complex and
     261             highly imperative. Avoiding the goto introduces a number of risks that could make it
     262             more difficult to maintain the relationship to the standard, lead to subtle differences
     263             in the parsing, and distance the code from its standard. -->
    264264        <exclude-pattern>/wp-includes/html-api/class-wp-html-processor\.php</exclude-pattern>
    265265        <exclude-pattern>/wp-includes/html-api/class-wp-html-doctype-info\.php</exclude-pattern>
     266
     267        <!-- Goto is an effective way to handle errors in decoders which expect valid bytes
     268             without impacting the fast path while avoiding bloating the code with redundant
     269             and risky handling code. Exclude forbidding goto in UTF-8 fallback code. -->
     270        <exclude-pattern>/wp-includes/compat-utf8\.php</exclude-pattern>
    266271    </rule>
    267272
Note: See TracChangeset for help on using the changeset viewer.