Automattic / Automattic/VIP-Coding-Standards

Inconsistent treatment of translated strings

Offen
#593 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
261
Forks
44
Ø Merge
19 Min.
Gemergte PRs (30 T.)
1

Beschreibung

## Bug Description

We seem to have some inconsistencies when looking at `_e()` and `_ex()` vs `echo __()` and `echo _x()`, for example. Note that none of these functions are escaped.

When the minimal code snippet below is checked with severity 5, only 2 violations for `__()` and `__x()` appear.

When it's severity 1, then violations for all 4 lines appear.

Screenshot 2020-10-26 at 11 48 11

Seems to originate from [this line](https://github.com/Automattic/VIP-Coding-Standards/blob/bfc7fc56e18bec55a3830de06d1d3be0443585dd/WordPress-VIP-Go/ruleset.xml#L222-L224) where we drop severity for some WPCS violations, as we apparently trust translations.

The [unsafe printing functions](https://github.com/WordPress/WordPress-Coding-Standards/blob/2f098354173a9e8487b0e8672fde8c526c7daf52/WordPress/Sniffs/Security/EscapeOutputSniff.php#L70-L73) are `_e()` and `_ex()` .

## Minimal Code Snippet

```php

## Tested Against `master` branch?

- [x] I have verified the issue still exists in the `master` branch of VIPCS.
- [x] I have verified the issue still exists in the `develop` branch of VIPCS.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit ruleset.xml um die Zeilen 222-224 und vergleiche dessen Behandlung der Schweregrade mit WordPress/Sniffs/Security/EscapeOutputSniff.php um die Zeilen 70-73. Reproduziere das bereitgestellte PHP-Snippet bei den Schweregraden 1 und 5 und überprüfe anschließend, dass die vier Fälle mit übersetzten Strings für die gemeldeten Fehlercodes konsistent behandelt werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.