Issue Bug Closed

#104998Type error on using addCacheTags from TypoScriptFrontendController

Karsten Nowak (undkonsorten) 09/17/24, 08:12 updated 10/15/24, 09:07

Description

Error occurs when addCacheTags function in TypoScriptFrontendController is used by extensions.
I had this with installed news in my TYPO3 13 (main branch) instance.

TYPO3\CMS\Core\Cache\CacheDataCollector::addCacheTags(): Argument #1 must be of type TYPO3\CMS\Core\Cache\CacheTag, array given, called in /app/vendor/typo3/cms-frontend/Classes/Controller/TypoScriptFrontendController.php on line 424

The relevant code is this line (424) in TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController

$cacheDataCollector->addCacheTags(array_map(fn(string $tag) => new CacheTag($tag), $tags));

That should be changed to

$cacheDataCollector->addCacheTags(...array_map(fn(string $tag) => new CacheTag($tag), $tags));

I will add a patch for that afterwards.

Reviews 1