Describe the bug
html/inc/cache.inc, in cache_check_diskspace():
$x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL,
USER_PROFILE_TTL, TOP_PAGES_TTL, INDEX_PAGE_TTL
);
USER_HOST_TTL is not defined anywhere in the tree — git grep USER_HOST_TTL returns only that one line. html/project.sample/cache_parameters.inc defines TEAM_PAGE_TTL, USER_PAGE_TTL, USER_PROFILE_TTL, TOP_PAGES_TTL, INDEX_PAGE_TTL, STATUS_PAGE_TTL, REMOTE_PROJECTS_TTL — but not USER_HOST_TTL. No caller passes it to get_cached_data() either; it looks like a cache category that was planned and never wired up.
On PHP 8 an undefined constant is a fatal Error (on PHP 7 it was an E_WARNING and evaluated to the string "USER_HOST_TTL", which max() harmlessly ignored among the integers).
Impact / reachability
cache_check_diskspace() returns early unless rand() % CACHE_SIZE_CHECK_FREQ == 0 (default 1 in 1000) and disk_usage("../cache") >= MAX_CACHE_USAGE (default 10 MB). So this only affects a project on the file cache backend (not memcached) once its html/cache/ dir grows past 10 MB — at which point roughly 1 request in 1000 returns HTTP 500 instead of pruning the cache. Narrow, but it's a live fatal and the pruning it was meant to do silently never happens.
Suggested fix
Drop USER_HOST_TTL from the max() list — nothing uses that TTL, so clean_cache()'s age threshold is unchanged in practice. (Alternatively add it to cache_parameters.inc, or wrap it in defined().)
Found while reviewing #6310; independent of that.
Reported with AI assistance (Claude Sonnet 5); verified against master @ b4b1bad96f.
Describe the bug
html/inc/cache.inc, incache_check_diskspace():USER_HOST_TTLis not defined anywhere in the tree —git grep USER_HOST_TTLreturns only that one line.html/project.sample/cache_parameters.incdefinesTEAM_PAGE_TTL,USER_PAGE_TTL,USER_PROFILE_TTL,TOP_PAGES_TTL,INDEX_PAGE_TTL,STATUS_PAGE_TTL,REMOTE_PROJECTS_TTL— but notUSER_HOST_TTL. No caller passes it toget_cached_data()either; it looks like a cache category that was planned and never wired up.On PHP 8 an undefined constant is a fatal
Error(on PHP 7 it was anE_WARNINGand evaluated to the string"USER_HOST_TTL", whichmax()harmlessly ignored among the integers).Impact / reachability
cache_check_diskspace()returns early unlessrand() % CACHE_SIZE_CHECK_FREQ == 0(default 1 in 1000) anddisk_usage("../cache") >= MAX_CACHE_USAGE(default 10 MB). So this only affects a project on the file cache backend (not memcached) once itshtml/cache/dir grows past 10 MB — at which point roughly 1 request in 1000 returns HTTP 500 instead of pruning the cache. Narrow, but it's a live fatal and the pruning it was meant to do silently never happens.Suggested fix
Drop
USER_HOST_TTLfrom themax()list — nothing uses that TTL, soclean_cache()'s age threshold is unchanged in practice. (Alternatively add it tocache_parameters.inc, or wrap it indefined().)Found while reviewing #6310; independent of that.
Reported with AI assistance (Claude Sonnet 5); verified against
master@b4b1bad96f.