Project

General

Profile

Actions

Bug #106060

closed

Missing Lifetime in cachetag generation

Added by Pascal Geldmacher 13 days ago. Updated 7 days ago.

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

100%

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 13 days ago

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

Actions #2

Updated by Gerrit Code Review 8 days 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 #3

Updated by Gerrit Code Review 8 days ago

Patch set 2 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 #4

Updated by Gerrit Code Review 7 days ago

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

Actions #5

Updated by Sascha Nowak 7 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF