Automattic / Automattic/VIP-Coding-Standards
Inconsistent treatment of translated strings
- Ngôn ngữ chính
- PHP
- Star
- 261
- Fork
- 44
- Merge trung bình
- 19 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
## 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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với ruleset.xml quanh các dòng 222-224 và so sánh cách xử lý mức độ nghiêm trọng của nó với WordPress/Sniffs/Security/EscapeOutputSniff.php quanh các dòng 70-73. Tái hiện đoạn mã PHP được cung cấp ở các mức độ nghiêm trọng 1 và 5, sau đó xác minh rằng bốn trường hợp chuỗi đã dịch được xử lý nhất quán đối với các mã lỗi được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- tooling
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100