WordPress / WordPress/plugin-check
Add check: runtime fatal-error prevention in PHP plugin code
Open
@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:
require/require_onceon dynamic or unguarded paths (withoutfile_exists/is_readablenearby).- Calling plugin/theme integration functions without
function_existsguard. - Instantiating optional classes without
class_existsguard. - Invoking dynamic callbacks without
is_callable. - Hooking callbacks that may not exist (array/class method) without
method_exists/ class guard.
Acceptance criteria
- Reports file + line.
- Provides actionable remediation guidance in message.
- Includes false-positive controls for clearly safe patterns.
- Includes tests for positive and negative cases.
Inspired by
Internal Scanner checks around parse/safety, especially phpcs_parse_errors.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.