Bug Report: Infinite Recursion in Pods Alternative Cache
Plugin Information
- Plugin: Pods Alternative Cache
- Version: 2.2.1
- WordPress Version: 6.x
- PHP Version: 8.x
Summary
The Pods Alternative Cache plugin causes a fatal PHP stack overflow error due to infinite recursion when current_user_can() is called during cache purge operations.
Steps to Reproduce
- Have Pods Alternative Cache plugin active
- Have a caching plugin installed (e.g., WP Rocket, SG Optimizer)
- Trigger a cache purge from the admin dashboard
- Visit:
/wp-admin/admin-post.php?action=purge_cache&type=all
Expected Behavior
Cache should be purged without errors.
Actual Behavior
PHP Fatal Error with stack overflow:
PHP Fatal error: Uncaught Error: Maximum call stack size of 8339456 bytes
(zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
in /public_html/wp-includes/plugin.php:173
Stack trace:
#0 wp-includes/plugin.php(173): apply_filters()
#1 wp-includes/capabilities.php(879): map_meta_cap()
#2 wp-includes/class-wp-user.php(790): WP_User->has_cap()
#3 wp-includes/capabilities.php(1021): user_can()
#4 wp-includes/capabilities.php(914): current_user_can()
#5 wp-content/plugins/pods-alternative-cache/classes/Pods/Alternative/Cache.php(116): current_user_can()
Root Cause Analysis
The plugin hooks into a capability-related filter (likely user_has_cap or map_meta_cap) and calls current_user_can() inside that hook. This creates an infinite recursion loop:
current_user_can()
→ map_meta_cap()
→ apply_filters()
→ Pods\Alternative\Cache hook (line 116)
→ current_user_can() ← RECURSION STARTS HERE
→ map_meta_cap()
→ apply_filters()
→ Pods\Alternative\Cache hook
→ current_user_can()
→ ... (continues until stack overflow)
Suggested Fix
Add a static recursion guard in the affected method in Cache.php:
// In classes/Pods/Alternative/Cache.php
private static $is_checking_capability = false;
public function your_capability_filter_method($allcaps, $caps, $args, $user) {
// Prevent infinite recursion
if (self::$is_checking_capability) {
return $allcaps;
}
self::$is_checking_capability = true;
try {
// Your existing logic that calls current_user_can()
if (current_user_can('some_capability')) {
// ...
}
} finally {
self::$is_checking_capability = false;
}
return $allcaps;
}
Environment Details
- Server: Cloudways (nginx + PHP-FPM)
- Object Cache: Redis (Object Cache Pro)
- Caching Plugin: WP Rocket / SG Optimizer
Workaround
Currently deactivating the plugin to prevent the error:
wp plugin deactivate pods-alternative-cache
Additional Notes
- The error only occurs during specific admin operations that trigger capability checks
- The recursion happens at
Cache.php line 116
- This appears to be a logic error where
current_user_can() should not be called inside a capability filter, or needs recursion protection
Contact
Feel free to reach out if you need additional debugging information or access to error logs.
Reported: 2025-12-16
Bug Report: Infinite Recursion in Pods Alternative Cache
Plugin Information
Summary
The Pods Alternative Cache plugin causes a fatal PHP stack overflow error due to infinite recursion when
current_user_can()is called during cache purge operations.Steps to Reproduce
/wp-admin/admin-post.php?action=purge_cache&type=allExpected Behavior
Cache should be purged without errors.
Actual Behavior
PHP Fatal Error with stack overflow:
Root Cause Analysis
The plugin hooks into a capability-related filter (likely
user_has_capormap_meta_cap) and callscurrent_user_can()inside that hook. This creates an infinite recursion loop:Suggested Fix
Add a static recursion guard in the affected method in
Cache.php:Environment Details
Workaround
Currently deactivating the plugin to prevent the error:
Additional Notes
Cache.phpline 116current_user_can()should not be called inside a capability filter, or needs recursion protectionContact
Feel free to reach out if you need additional debugging information or access to error logs.
Reported: 2025-12-16