After updating to wpForo 3.1.6, clearing wpForo caches, and purging Cloudflare cache, the site began returning 504s and then CloudLinux 508s as PHP workers accumulated.
PHP logged repeated fatal errors:
PHP Fatal error: Uncaught Error: Maximum call stack size ... reached. Infinite recursion?
The recursion path is:
Posts::get_full_url()
→ Cache::create('item', ..., 'url')
→ Cache::check()
→ WPF()->statistic()
→ statistic() sets last_post_url via Posts::get_url()
→ Posts::get_full_url()
→ Cache::create()
→ Cache::check()
→ ...
Relevant code in classes/Cache.php 3.1.6:
// Dynamic limit based on online members (scales with forum activity)
$stats = WPF()->statistic();
$online = max( 2, intval( $stats['online_members_count'] ) );
WPF()->statistic() eventually calls:
$stats['last_post_url'] = $this->post->get_url( $posts[ $first ]['last_post'] );
which re-enters URL-cache generation before the original URL cache write has completed.
A one-line fix that has stopped the recursion on our site is to obtain the online-member count directly:
$online = max( 2, intval( WPF()->member->online_members_count() ) );
replacing:
$stats = WPF()->statistic();
$online = max( 2, intval( $stats['online_members_count'] ) );
This preserves the intended dynamic cache-file limit while avoiding the recursive statistics → URL cache → statistics dependency.
Environment: wpForo 3.1.6, WordPress, PHP 8.5, CloudLinux/cPanel.
We saw four stack-exhaustion fatals, with stack traces exceeding 156,000 frames. After applying the one-line change above, repeated uncached forum requests return normally and no new recursion errors have appeared.