Skip to content

FIX: Litespeed Cache plugin compatibility https://github.com/Crocoblock/jetformbuilder/issues/603#641

Open
Gawuww wants to merge 1 commit into
release/3.6.1from
issue/603
Open

FIX: Litespeed Cache plugin compatibility https://github.com/Crocoblock/jetformbuilder/issues/603#641
Gawuww wants to merge 1 commit into
release/3.6.1from
issue/603

Conversation

@Gawuww
Copy link
Copy Markdown
Collaborator

@Gawuww Gawuww commented May 12, 2026

@Gawuww Gawuww linked an issue May 12, 2026 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

🤖 AI PR Review

Risk level: medium

Review

Summary

  • This PR changes the Litespeed compatibility check in compatibility/litespeed/litespeed.php::condition() from a simple LSCWP_V constant check to also verify the Litespeed ESI status via apply_filters('litespeed_esi_status', false).

What I looked at

  • File: compatibility/litespeed/litespeed.php
  • Function: public function condition(): bool

Positives

  • The change addresses a real bug: the presence of the LSCWP_V constant does not guarantee that Litespeed ESI (Edge Side Includes) is enabled. Checking the ESI status avoids erroneously enabling compatibility when ESI is not active.
  • The implementation is simple and avoids heavy runtime work (single apply_filters call).

Potential issues / suggestions

  1. Behavior change / backward compatibility
  • The previous implementation returned true when LSCWP_V was defined. Now the check requires the litespeed_esi_status filter to return truthy. This is an intentional behaviour change (fix), but it may cause different runtime paths on sites that previously relied on the old check. This is acceptable for a compatibility fix, but call it out in changelog (done below).
  1. apply_filters timing / plugin initialization
  • apply_filters('litespeed_esi_status', false) is fine—if Litespeed cache hasn't added that filter yet, the default false will be returned which is safe. However, if this method may run very early (during plugin load) before Litespeed has registered its filter, you might mistakenly conclude ESI is disabled when it is in fact enabled. You already guard by checking the LSCWP_V constant, but that constant may be present before the filter is registered.
  • Optional improvement: check for the filter presence to make the intent explicit (has_filter), or check for an Litespeed helper function if one exists (for example, if Litespeed exposes a function or class method to check ESI). Example:
    if ( defined( 'LSCWP_V' ) && has_filter( 'litespeed_esi_status' ) ) {
    return (bool) apply_filters( 'litespeed_esi_status', false );
    }
    return false;
    This makes the timing dependency explicit and avoids running the filter when no listener is present.
  1. Namespacing & safety
  • Using apply_filters with a default of false is safe. No escaping/sanitization issues because this is a boolean check internal to logic. No user input involved.
  1. Tests
  • I could not find unit/integration tests for this compatibility class. Please consider adding a small unit/integration test that simulates the presence of LSCWP_V and toggles the litespeed_esi_status filter to assert that condition() returns expected values. This is low-effort and helpful to avoid regressions.
  1. Docblock / comment
  • Consider adding a one-line comment above the check explaining why we now consult the litespeed_esi_status filter (clarify the difference between LSCWP_V presence and ESI being active). That helps future maintainers.

Conclusion

  • Change is appropriate and fixes the issue reported in Litespeed Cache plugin compatibility #603. Minor improvement: consider using has_filter to make timing explicit. Add a unit/integration test and a short inline comment. No security concerns found.

Suggested changelog entry

- FIX: Litespeed Cache compatibility — only enable compatibility when Litespeed ESI is active (uses litespeed_esi_status filter).

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.

Litespeed Cache plugin compatibility

1 participant