Issue Bug Resolved

#110660config.cache_clearAtMidnight is a no-op since the default cache lifetime was raised to one year

Lina Wolf 09/09/26, 07:18 updated 09/30/26, 16:10

Description

  1. raised CacheLifetimeCalculator::defaultCacheTimeout from 86400 (24 hours)
    to 365 * 86400 (one year). It was released with 14.3.1 (main and 14.3).

That constant is also the fallback for the TypoScript setting config.cache_period:

// typo3/sysext/frontend/Classes/Cache/CacheLifetimeCalculator.php:115
// Cache period was set via TypoScript "config.cache_period", otherwise it's the default of 24 hours
$cacheTimeout = (int)($renderingInstructions['cache_period'] ?? self::defaultCacheTimeout);

The inline comment above that line still says 24 hours and is outdated as well.

As a side effect, config.cache_clearAtMidnight silently lost its effect in the
default configuration. The CacheTimeout middleware rounds down to midnight of the
day the page is scheduled to expire:

// typo3/sysext/frontend/Classes/Middleware/CacheTimeout.php:41
$timeOutTime = min($GLOBALS['EXEC_TIME'] + $cacheDataCollector->resolveLifetime(), PHP_INT_MAX);
$midnightTime = mktime(0, 0, 0, (int)date('m', $timeOutTime), (int)date('d', $timeOutTime), (int)date('Y', $timeOutTime));
if ($midnightTime > $GLOBALS['EXEC_TIME']) {
    $cacheDataCollector->restrictMaximumLifetime($midnightTime - $GLOBALS['EXEC_TIME']);
}

With the former 24 hour default, the expiry day was always today or tomorrow, so the
cache expired at the upcoming midnight — the documented purpose of the setting. With a
one year default, the expiry day is one year ahead, so the cache now expires at midnight
roughly 365 days from now unless config.cache_period is set explicitly.

Steps to reproduce

TYPO3 14.3.6, config.cache_clearAtMidnight = 1, no config.cache_period set.

Actual: response header x-typo3-cache-lifetime: 31493211 (~364.5 days, midnight of the
same date next year).
Expected: the cache expires at the upcoming midnight.

Missing changelog

As #109054 was classified as a bugfix, there is no changelog entry. Neither integrators
nor the documentation had a chance to learn about the new default — Changelog/14.3.x/
holds 19 Important-* entries for exactly this kind of behavioural change in a patch
release.

Suggested resolution

  1. Decide how cache_clearAtMidnight should behave: either restrict the lifetime to the
    upcoming midnight regardless of the configured cache period, or deprecate the setting
    (CacheTimeout.php already carries a @todo questioning the concept because it depends on
    the server timezone).
  2. Add an Important-109054-* changelog entry to Changelog/14.3.x/ documenting the raised
    default and its effect on cache_clearAtMidnight.
  3. Update the outdated “default of 24 hours” comment in CacheLifetimeCalculator.

Originally reported on the documentation side:
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-Typoscript/issues/1792
The TypoScript Reference is being corrected in
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-Typoscript/pull/1813

Reviews 2

History 27

  1. Wouter Wolters commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-09-30T14:55:09+00:00" > 09/30/26, 14:55 </span>

    Applied in changeset commit:15179e3b2b9d8aba3c3c374e63b83b7efbf58389.

  2. Gerrit Code Review pushed patch set 2 for 14.3 to change 96222 status Resolved Under Review <span data-processor="relativetime" data-value="2026-09-30T15:00:45+00:00" > 09/30/26, 15:00 </span>

  3. Wouter Wolters commented and changed status Under Review Resolved <span data-processor="relativetime" data-value="2026-09-30T16:10:10+00:00" > 09/30/26, 16:10 </span>

    Applied in changeset commit:a0ed4ef493b8bdda7325e9b1f0a3ebd85702be97.