WordPress / WordPress/plugin-check

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

Open
#1,273 0 comments 0 reactions 1 assignee View on GitHub

@davidperezgar is already working on this.

Since Apr 22, 2026.

Checks
Dominant language
PHP
Stars
362
Forks
126
Avg merge
1d 23h
Merged PRs (30d)
22

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.