#107316Negative cache lifetime calculated for page cache
Description
the same issue as in Bug #105776 may occur in TYPO3 12.4 too:
When a page has a starttime or endtime setting in the past, a negative cachetime is calculated. This will result in caches that are never used or will even throw an exception, like when using the RedisBackend.
The problem seems to be in the method \TYPO3\CMS\Frontend\Cache\CacheLifetimeCalculator::calculateLifetimeForPage. If a page, has a starttime, the cachetimeout is calculated as $starttime – $currenttime “. If the starttime is in the past, the resulting cache TTL is negative.
Tested with TYPO3 12.4.34 with the redis backend used for the page cache.
Reviews 1
Related issues 1
Files 1
History 47
-
SAMUEL LIU changed Related to #105776 <span data-processor="relativetime" data-value="2025-08-20T15:32:46+00:00" > 08/20/25, 15:32 </span>
-
SAMUEL LIU commented and changed attached FixNegativeCacheLifetime.diff <span data-processor="relativetime" data-value="2025-08-20T15:35:48+00:00" > 08/20/25, 15:35 </span>
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 90475 status
NewUnder Review <span data-processor="relativetime" data-value="2025-08-22T13:06:09+00:00" > 08/22/25, 13:06 </span> -
Gerrit Code Review pushed patch set 2 for 12.4 to change 90475 <span data-processor="relativetime" data-value="2025-08-22T13:29:26+00:00" > 08/22/25, 13:29 </span>
-
Gerrit Code Review pushed patch set 3 for 12.4 to change 90475 <span data-processor="relativetime" data-value="2025-08-22T13:36:18+00:00" > 08/22/25, 13:36 </span>
-
Christian Kuhn commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-08-22T14:20:08+00:00" > 08/22/25, 14:20 </span>Applied in changeset commit:b15b40e01cf78f27a42bf1356c08695f002d55bf.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T13:58:16+00:00" > 12/02/25, 13:58 </span>
SAMUEL LIU wrote:
> the same issue as in Bug #105776 may occur in TYPO3 12.4 too:
>
>
>
> When a page has a starttime or endtime setting in the past, a negative cachetime is calculated. This will result in caches that are never used or will even throw an exception, like when using the RedisBackend.
>
> The problem seems to be in the method \TYPO3\CMS\Frontend\Cache\CacheLifetimeCalculator::calculateLifetimeForPage. If a page, has a starttime, the cachetimeout is calculated as $starttime – $currenttime “. If the starttime is in the past, the resulting cache TTL is negative.
>
> Tested with TYPO3 12.4.34 with the redis backend used for the page cache.
I provide a patch to fix it. it works for me well.