Automattic / Automattic/VIP-Coding-Standards

Flag incorrectly constructed mailto links

Offen
#556 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Type: Enhancement
Vorherrschende Sprache
PHP
Sterne
261
Forks
44
Ø Merge
19 Min.
Gemergte PRs (30 T.)
1

Beschreibung

## What problem would the enhancement address for VIP?

Some developers are not aware that `esc_url()` supports more than just the `http` and `https` protocols. The default list also includes ftp, ftps, mailto, news, irc, gopher, nntp, feed, and telnet as well.

of those extra ones, the most common is `mailto`, and a common mistake is to split a URL into a static `'mailto:'` and a email address variable/string escaped with something that isn't `esc_url()`.

## Describe the solution you'd like

Add a new sniff, or consider improving ProperEscapingFunction, so that we look for `'mailto:' string before an escaping function.

## What code should be reported as a violation?

```php
Email us

Email us

Email us

Email us

Email us

Email us
```

There are likely other ways to get a similar output.

## What code should *not* be reported as a violation?

```php
Email us

">Email us
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit dem im Issue erwähnten ProperEscapingFunction-Sniff und vergleichen Sie dessen Behandlung der aufgeführten verletzenden und nicht verletzenden PHP-Beispiele. Die Aufgabe ist erledigt, wenn inkorrekt konstruierte mailto-Links gemeldet werden, während mailto-Werte, die durch esc_url() geleitet werden, akzeptiert werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php, wordpress
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.