Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Inconsistent treatment of translated strings

Aperta
#593 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php
Ambito
tooling

Direzione di ricerca

Inizia da ruleset.xml intorno alle righe 222-224 e confronta la gestione della severità con quella di WordPress/Sniffs/Security/EscapeOutputSniff.php intorno alle righe 70-73. Riproduci lo snippet PHP fornito con le severità 1 e 5, quindi verifica che i quattro casi di stringhe tradotte ricevano un trattamento coerente per i codici di errore segnalati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 where we drop severity for some WPCS violations, as we apparently trust translations.

The unsafe printing functions are _e() and _ex() .

Minimal Code Snippet

<?php

echo __( 'foo', 'bar' );
_e( 'foo', 'bar' );

echo _x( 'foo', 'context', 'bar' );
_ex( 'foo', 'context', 'bar' );

Error Code

WordPress.Security.EscapeOutput.OutputNotEscaped and WordPress.Security.EscapeOutput.UnsafePrintingFunction

Environment

Use php -v and composer show to get versions.

Question Answer
PHP version 7.4.8
PHP_CodeSniffer version 3.5.6
VIPCS version 2.2.0

Additional Context (optional)

Tested Against master branch?

  • I have verified the issue still exists in the master branch of VIPCS.
  • I have verified the issue still exists in the develop branch of VIPCS.
Lingua principale
PHP
Stelle
261
Fork
44
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Automattic/VIP-Coding-Standards

Tutte le issue di Automattic/VIP-Coding-Standards

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.