Add check: runtime fatal-error prevention in PHP plugin code

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

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

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

2026年4月22日 から。

  • #1320 @faisalahammad による — マージされずにクローズ

評価

この issue はまだ評価されていません。

説明

Checks

Summary

Add a check to detect high-risk patterns that commonly cause runtime fatals in plugins.

Why

Parse-error checks are useful, but many production fatals come from runtime assumptions (missing functions/classes/files/callbacks).

Proposed detection

Flag risky cases such as:

  1. require / require_once on dynamic or unguarded paths (without file_exists/is_readable nearby).
  2. Calling plugin/theme integration functions without function_exists guard.
  3. Instantiating optional classes without class_exists guard.
  4. Invoking dynamic callbacks without is_callable.
  5. Hooking callbacks that may not exist (array/class method) without method_exists / class guard.

Acceptance criteria

  1. Reports file + line.
  2. Provides actionable remediation guidance in message.
  3. Includes false-positive controls for clearly safe patterns.
  4. Includes tests for positive and negative cases.

Inspired by

Internal Scanner checks around parse/safety, especially phpcs_parse_errors.

主要言語
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 を短くまとめたダイジェスト。