Skip to content

9A. Report a require that left the guard constant undefined - #68

Open
nikolaystrikhar wants to merge 1 commit into
47-lifecycle-actionsfrom
51-guard-constant-verified
Open

9A. Report a require that left the guard constant undefined#68
nikolaystrikhar wants to merge 1 commit into
47-lifecycle-actionsfrom
51-guard-constant-verified

Conversation

@nikolaystrikhar

Copy link
Copy Markdown
Contributor

What: Loader::load() verifies the guard constant after the require_once and reports a missing one down both channels of Traits\Reports_Errors_doing_it_wrong() and {prefix}/plugin_absorber/error — leaving loaded, the activation callback and every skip reason untouched.

Usage:

add_action( 'give/plugin_absorber/error', static function ( $message ) {
    error_log( $message );
    // …"give-recurring" was required and left GIVE_RECURRING_VERSION undefined,
    // so nothing stands a standalone copy down.
}, 10, 2 );

Why this way:

A guard nothing checks is a guarantee nobody has. The constant was only ever read before the require. A typo in the key, or a bundled plugin defining its constant from its own plugins_loaded callback, left the code in memory with no load guard — and the re-declaration fatal one activation away, while every counter said the load went perfectly.

A report, not a skip. The require happened and cannot be undone: the code is in memory, so the activation callback must still run and loaded must still fire. Announcing a skip would tell a host that running code is not there.

The name only ever arrives as a value. Sub_Plugin owns it, so no literal constant name enters src/ for Strauss's constant_prefix to rewrite.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Enterprise

Run ID: 56bcb475-b3cc-48e6-99b9-3bb73414e2ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant