Bug #106060
closedMissing Lifetime in cachetag generation
100%
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)
);
}
}
Updated by Pascal Geldmacher 13 days ago
The problem only happens if the feature frontend.cache.autoTagging is disabled.
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
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
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
Updated by Sascha Nowak 7 days ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset ae09ed5db73ab7b209e4631062109acfb06dc031.