Reduce false positives: incorrect warning about $wpdb->prepare

オープン
#1,333 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@faisalahammad がすでに取り組んでいます。

2026年6月5日 から。

  • #1348 @faisalahammad による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
静か
技術スタック
php
領域
tooling

調査の方向性

plugin-check の解析を使用して、$wpdb->get_results($wpdb->prepare($query, ...$args)) と echo $dom->saveHtml(); に対して報告された警告を再現します。どのチェックがメッセージを生成しているかを追跡し、誤検知に対して意図されている処理を判断します。有効なプリペアドクエリとすでに安全な HTML に誤った警告が表示されなくなり、実際の検出結果を弱めていなければ完了です。

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

説明

Thanks fotr this plugin, its very usefull.

I would like to point out that sometimes I get false positives. It would be great if I could exclude such from the results so that if I Check my plugin again I don't see those again.

One such false positive is

$wpdb->get_results(
   $wpdb->prepare($query, ...$args)
);

Passing the query to the prepare function leads to the following result:

ERROR | WordPress.DB.PreparedSQL.NotPrepared Use placeholders and $wpdb->prepare(); found $query
The helper function executes a passed-in query variable, which must be prepared by the caller.

Another one is this: echo $dom->saveHtml(); This does not need escaping as the html is already safe;.

主要言語
PHP
スター
365
フォーク
135
平均マージ
1日 8時間
マージ済み PR(30日)
20

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

WordPress/plugin-check のほかの issue

WordPress/plugin-check の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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