Automattic / Automattic/VIP-Coding-Standards
Inconsistent treatment of translated strings
- Lenguaje dominante
- PHP
- Estrellas
- 261
- Forks
- 44
- Merge medio
- 19 min
- PR fusionados (30 d)
- 1
Descripción
## 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.

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.
Guía de contribución
Línea de trabajo
Comienza con ruleset.xml alrededor de las líneas 222-224 y compara su gestión de la severidad con WordPress/Sniffs/Security/EscapeOutputSniff.php alrededor de las líneas 70-73. Reproduce el fragmento de PHP proporcionado con las severidades 1 y 5 y, a continuación, verifica que los cuatro casos de cadenas traducidas reciban un tratamiento coherente para los códigos de error indicados.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- php
- Área
- tooling
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100