Open
Description
PHPCS 3.1, WPCS 0.13.0, PHP 5.6.30
A backslash used to indicate the global namespace prevents customAutoEscapedFunctions from being recognized.
I have a ruleset like this:
<?xml version="1.0"?>
<ruleset name="WordPress-Me">
<rule ref="WordPress.XSS.EscapeOutput">
<properties>
<property name="customAutoEscapedFunctions" value="ESPN_AMP, AMP_HTML_Utils" type="array" />
</properties>
</rule>
</ruleset>
And some code like this:
public static function amp_additional_css_styles() {
$css = 'color: black;';
echo \ESPN_AMP::sanitize_meta_css( $css );
}
which generates this error:
373 | ERROR | Expected next thing to be an escaping function (see Codex for 'Data Validation'), not '\'
| | (WordPress.XSS.EscapeOutput.OutputNotEscaped)
If I drop the backslash (\
):
public static function amp_additional_css_styles() {
$css = 'color: black;';
echo ESPN_AMP::sanitize_meta_css( $css );
}
Then PHPCS no longer finds the error.