WordPress / WordPress-Coding-Standards

PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
MIT License
2.56k stars 487 forks source link

WP 5.5: allow for esc_xml() #1937

Closed jrfnl closed 1 year ago

jrfnl commented 4 years ago

WP 5.5 will introduce a new esc_xml() escaping function.

At a later point in time (not in WP 5.5), it is expected that the I18n variants esc_xml__() and esc_xml_e() will be added.

The WPCS sniffs which examine output for being escaped should be updated to allow for escaping using esc_xml().

Note: as this function won't be available until WP 5.5, we may need to take the minimum supported WP version into account when sniffing this for the time being.

Ref: https://make.wordpress.org/core/2020/07/21/new-esc_xml-function-in-wordpress-5-5/

szepeviktor commented 1 year ago

Until that this is how to add that function.

<rule ref="WordPress.Security.EscapeOutput">
    <properties>
        <property name="customEscapingFunctions" type="array">
            <element value="esc_xml"/>
        </property>
    </properties>
</rule>
jrfnl commented 1 year ago

Looks like the I10n variants still aren't available (per WP 6.3).

jrfnl commented 1 year ago

Trac ticket about the I10n functions: https://core.trac.wordpress.org/ticket/50551