Automattic / Automattic/VIP-Coding-Standards

Support when esc_xml() should be used

Open
#555 0 comments 0 reactions 0 assignees View on GitHub
Standard: VIP-Go Type: Enhancement
Dominant language
PHP
Stars
261
Forks
44
Avg merge
19m
Merged PRs (30d)
1

Description

## What problem would the enhancement address for VIP?

`esc_xml()` is being [introduced in WP 5.5](https://make.wordpress.org/core/2020/07/21/new-esc_xml-function-in-wordpress-5-5/).

It would be great if WordPressVIPMinimum.Security.ProperEscapingFunction sniff could recognise when an escaping function is being used (typically `esc_html()` up to now, but someone may have used an incorrect escaping function) in an XML context.

## Describe the solution you'd like

Update the existing sniff.

Update our public docs to better clarify when `esc_xml()` should be used.

## What code should be reported as a violation?

{Needs examples}

## What code should *not* be reported as a violation?

{Needs examples}

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing WordPressVIPMinimum.Security.ProperEscapingFunction sniff and the public documentation it references. Use the esc_xml() introduction and the requested XML-context behavior to define representative reported and non-reported examples; done means the sniff recognizes the correct escaping function and the documentation explains when esc_xml() should be used.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.