Merged
Conversation
To help hosts understand what data was submitted, the values will now be saved into a log file.
This makes a number of improvements to object cache detection:
- The `WP_REDIS_VERSION constant is set by a plugin file, not the actual drop-in, so it produces inaccurate results when the drop-in is present but the plugin is deactivated.
- Bare `class_exists('Memcached')` / `class_exists('Memcache')` checks can cause false positives because they only test whether the PHP extension is loaded, not whether it's actually the active cache backend.
- `WP_CACHE_KEY_SALT` is not just a Memcached signal. It's used by multiple drop-ins (including Redis), so should not be used as a reliable indicator.
- Redis detection now uses `method_exists($wp_object_cache, 'redis_status')`. Because this method lives in the drop-in class, it will work regardless of whether the plugin is active.
- Memcached detection now inspects the `$mc` property on the cache object and checks whether it's an actual Memcached or Memcache instance. Prevents false positives when the extension is available but the drop-in is not.
- WP Redis detection still uses `WP_REDIS_OBJECT_CACHE` but now also falls back to a `$redis` property check.
- The `redis-disconnected` return value distinguishes "Redis drop-in installed and connected" from "Redis drop-in installed but silently falling back to in-memory because the server is unreachable."
- Added Object Cache Pro detection.
- Added LiteSpeed Cache detection.
- Added W3 Total Cache detection.
- Added APCu drop-in detection.
- 'ext:unknown' is returned early when $wp_object_cache is not a valid object.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the environment-reporting logic in rtc-test.php so object_cache_type is inferred from the active drop-in object rather than from loose constants/extension checks, reducing false positives in cache backend reporting.
Changes:
- Reworked object cache detection to inspect the active
$wp_object_cacheinstance first and returnext:unknownearly when it is unavailable. - Replaced broad Redis/Memcache heuristics with drop-in-specific checks such as
redis_status(),$redis, and$mc. - Added explicit detection branches for Object Cache Pro, LiteSpeed Cache, W3 Total Cache, APCu, and a
redis-disconnectedstate.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
dd32
reviewed
May 5, 2026
dd32
approved these changes
May 5, 2026
Co-authored-by: Dion Hulse <dd32@dd32.id.au>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes a number of improvements to object cache detection to prevent false positives and inaccurate outcomes:
class_exists('Memcached')/class_exists('Memcache')checks can cause false positives because they only test whether the PHP extension is loaded, not whether it's actually the active cache backend.WP_CACHE_KEY_SALTis not just a Memcached signal. It's used by multiple drop-ins (including Redis), so should not be used as a reliable indicator.method_exists($wp_object_cache, 'redis_status'). Because this method lives in the drop-in class, it will work regardless of whether the plugin is active.$mcproperty on the cache object and checks whether it's an actual Memcached or Memcache instance. Prevents false positives when the extension is available but the drop-in is not.WP_REDIS_OBJECT_CACHEbut now also falls back to a$redisproperty check.redis-disconnectedreturn value distinguishes "Redis drop-in installed and connected" from "Redis drop-in installed but silently falling back to in-memory because the server is unreachable."