Automattic / Automattic/VIP-Coding-Standards
New sniff: Flag unusable query parameters
- Lingua principale
- PHP
- Stelle
- 261
- Fork
- 44
- Merge medio
- 19m
- PR unite (30g)
- 1
Descrizione
## What problem would the enhancement address for VIP?
On VIP, a selection of [query parameters](https://docs.wpvip.com/technical-references/caching/page-cache/#h-query-parameters) are stripped at the edge which so that the URLs are not cached as separate variants. These parameters are predominantly used for analytics. As such, `$_GET['...']` and other ways of reading the values of the query parameters will return `null` on production and non-production environments.
Helping customers to appreciate when a query parameter isn't going to work on a VIP-hosted site, should save some hours of debugging.
## Describe the solution you'd like
A new sniff to create violations when trying to read one of the documented parameters.
## What code should be reported as a violation?
Substitute `foo` for any of the params in the documentation.
```php
$_GET['foo']
$_REQUEST['foo']
filter_input( INPUT_GET, 'foo'[, ...[, ...]])
$qs = filter_input_array( INPUT_GET[, ...[, ...]] )
$qs['foo'];
```
There may well be other ways to retrieve query string parameters as well.
## What code should *not* be reported as a violation?
```php
$_GET['not-foo']
$_POST['foo']
filter_input( INPUT_POST, 'foo'[, ...[, ...]])
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Non viene indicato alcun file di implementazione né alcun test. Inizia individuando gli sniff PHP_CodeSniffer esistenti e i relativi test, quindi confronta i parametri VIP documentati con le forme di accesso GET elencate; il lavoro è completato quando vengono segnalate tali forme, ma non POST né i parametri non correlati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100