Automattic / Automattic/VIP-Coding-Standards

Flag incorrectly constructed mailto links

オープン
#556 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: Enhancement
主要言語
PHP
スター
261
フォーク
44
平均マージ
19分
マージ済み PR(30日)
1

説明

## 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
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Issue で言及されている ProperEscapingFunction sniff から始め、一覧にある違反する PHP の例と違反しない PHP の例の処理を比較してください。誤って構築された mailto リンクが報告され、esc_url() を通過した mailto 値が受け入れられれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php, wordpress
領域
tooling
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。