Issue Bug Closed

#80399Extended CategoryRegistry is loaded from cached tca with core CategoryRegistry class name

Marc Bastian Heinrichs 03/22/17, 16:16 updated 04/01/20, 21:14

Description

While implemeting a solution for #53045, I run into the problem, that registering the unserialized CategoryRegistry singleton is done with the core class name and not the extended name.

Idea for a quick solution in ExtensionManagementUtility::loadBaseTca

- GeneralUtility::setSingletonInstance(CategoryRegistry::class, $cacheData['categoryRegistry']);
+ if (!is_a($cacheData['categoryRegistry'], CategoryRegistry::class)) {
+    throw ...
+ }
+ GeneralUtility::setSingletonInstance(get_class($cacheData['categoryRegistry']), $cacheData['categoryRegistry']);

To reproduce register a “empty” extended CategoryRegistry

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Core\Category\CategoryRegistry::class] = array(
    'className' => \MyVendor\TestExtension\Category\CategoryRegistry::class
);

Notice with a cached tca the category field element in menu types categorized_pages or categorized_content is not allowed anymore.

Reviews 2