Project

General

Profile

Actions

Bug #106060

open

Missing Lifetime in cachetag generation

Added by Pascal Geldmacher 5 days ago. Updated about 5 hours ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2025-02-03
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The ContentObjectRenderer creates in the render function cacheTags, but don't set the lifetime which can leads to an error
gmdate(): Argument #2 ($timestamp) must be of type ?int, float given because it's use the PHP_MAX_INT value.
At the moment this onyl happens if I use the yoast preview in the backend context.

I have a TypoScript snippet which creates an cache entry:

    cache {
        lifetime = unlimited
        tags = tag_typoscript
    }

Here is the part of the ContentObjectRenderer where the cacheTag does not get the lifetime:

  // Store cache
        if ($cacheConfiguration !== null && $this->getRequest()->getAttribute('frontend.cache.instruction')->isCachingAllowed()) {
            $key = $this->calculateCacheKey($cacheConfiguration);
            if (!empty($key)) {
                $cacheFrontend = GeneralUtility::makeInstance(CacheManager::class)->getCache('hash');
                $tags = $this->calculateCacheTags($cacheConfiguration);
                $lifetime = $this->calculateCacheLifetime($cacheConfiguration);
                $cachedData = [
                    'content' => $content,
                    'cacheTags' => $tags,
                ];
                $cacheFrontend->set($key, $cachedData, $tags, $lifetime);
                $this->getRequest()->getAttribute('frontend.cache.collector')->addCacheTags(
                    ...array_map(fn(string $tag) => new CacheTag($tag), $tags)
                );
            }
        }
Actions #1

Updated by Pascal Geldmacher 5 days ago

The problem only happens if the feature frontend.cache.autoTagging is disabled.

Actions #2

Updated by Gerrit Code Review about 5 hours ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/88100

Actions

Also available in: Atom PDF