#106177Exception in NodeFactory when having more than one fieldControl of the same name for a field
Description
If a field, e.g. a simple input field has more than one fieldControl with the same name an exception will be raised
TypeError: Cannot access offset of type array on array
in /var/www/html/vendor/typo3/cms-backend/Classes/Form/NodeFactory.php line 166
$className = $this->nodeTypes[$type] ?? $this->nodeTypes[‘unknown’];
How to reproduce:
Have 2 or more nodes registered under the same name for any input field.
For example:
EXT:ai_suite registers a node for pages.seo_title
$GLOBALS['TCA']['pages']['columns']['seo_title']['config'] = array_merge_recursive(
$GLOBALS['TCA']['pages']['columns']['seo_title']['config'],
[
'fieldControl' => [
'importControl' => [
'renderType' => 'aiSeoPageTitle'
]
]
]
);
EXT:sup_header registers another node for the same field
$GLOBALS['TCA']['pages']['columns']['seo_title']['config'] = array_merge_recursive(
$GLOBALS['TCA']['pages']['columns']['seo_title']['config'],
[
'fieldControl' => [
'importControl' => [
'renderType' => 'addIconTextField',
],
],
]
);
Note: both use importControl as the “button” name.
Using different names solves this issue, however there should be a better explanation in the exception message, imo.
From the documentation it is unclear if importControl is a custom value.
I already suggested a change in the documentation.
(https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/FormEngine/Rendering/Index.html#add-fieldcontrol-example)
Reviews 3
History 310
-
Gerrit Code Review pushed patch set 1 for main to change 88261 status
NewUnder Review 02/18/25, 12:50 -
Garvin Hicking commented 02/18/25, 12:52
-
Gerrit Code Review pushed patch set 2 for main to change 88261 02/18/25, 12:52
-
Gerrit Code Review pushed patch set 3 for main to change 88261 02/18/25, 18:20
-
Gerrit Code Review pushed patch set 4 for main to change 88261 02/18/25, 19:14
-
Gerrit Code Review pushed patch set 5 for main to change 88261 02/19/25, 17:16
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 88287 02/19/25, 21:57
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 88288 02/19/25, 21:57
-
Garvin Hicking commented and changed status
Under ReviewResolved done0 %100 % 02/20/25, 08:25Applied in changeset commit:747502bb224401853878f68d06205883c3879824.
-
Benni Mack changed status
ResolvedClosed 12/02/25, 14:27
I pushed a patch for a distinct exception for this.
Sadly due to the usage of “array_merge_recursive” there’s nothing the core can do at the time. The extensions themselves need to check for a possible existing duplicate identifier, and ensure uniqueness.
When TYPO3 is receiving the merged array, it cannot detect the prior use to array_merge_recursive and cannot extract multiple (proper) configuration items.
I see you already changed the docs for the unique identifier, that’s a great help already, thank you!