Automattic / Automattic/VIP-Coding-Standards
Inconsistent treatment of translated strings
- 主要言語
- PHP
- スター
- 261
- フォーク
- 44
- 平均マージ
- 19分
- マージ済み PR(30日)
- 1
説明
## 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.
コントリビューションガイド
調査の方向性
ruleset.xml の 222-224 行付近から始め、WordPress/Sniffs/Security/EscapeOutputSniff.php の 70-73 行付近と重大度の扱いを比較してください。提示された PHP スニペットを重大度 1 と 5 で再現し、その後、翻訳された文字列の 4 つのケースが、報告されたエラーコードに対して一貫して扱われることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100