#109320Undefined array key _TOGGLE in FlexFormTools.php line 812
Description
TYPO3 12.4.42
Using the cli tool cleanup:flexforms or referenceindex:update, I have a warning on a malformed/corrupted flexform in the database.
The warning is:
PHP Warning: Undefined array key "_TOGGLE" in vendor/typo3/cms-core/Classes/Configuration/FlexForm/FlexFormTools.php line 812
The flexform data is:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3FlexForms>
<data>
<sheet index="options">
<language index="lDEF">
<field index="seLinks">
<el index="el">
<field index="5afcf183b4579415400229">
<value index="_TOGGLE">0</value>
</field>
<field index="5afcf186b1b3a873665489">
<value index="_TOGGLE">0</value>
</field>
<field index="5afcf20891a39393158985">
<value index="obLinks">
<el>
<field index="link_title">
<value index="vDEF">Télécharger la brochure</value>
</field>
<field index="link">
<value index="vDEF">t3://file?uid=110511</value>
</field>
<field index="link_icon">
<value index="vDEF">filigramme</value>
</field>
<field index="id">
<value index="vDEF">f3420bd6e21abe06b6a74a9ca65ca411f78dc0c6</value>
</field>
</el>
</value>
<value index="_TOGGLE">1</value>
</field>
</el>
</field>
</language>
</sheet>
</data>
</T3FlexForms>
I guess it’s because orphan _TOGGLE are missing their value.
I don’t know what cause the xml to be in that state.
The error can also occurs in backend, when saving the record.
Easy patch would to add ?? before the is_array test:
- $newSectionEl = $value['el'][$theType];
+ $newSectionEl = $value['el'][$theType] ?? null;
if (is_array($newSectionEl)) {Reviews 1
History 3
-
Rémy DANIEL commented 03/23/26, 09:50
-
Rémy DANIEL commented 03/23/26, 09:57
The offending code has been removed by https://review.typo3.org/c/Packages/TYPO3.CMS/+/81504 (v13+).
This issue can be closed, I will patch my project manually.
-
Garvin Hicking commented and changed status
NewClosed 03/23/26, 11:14Thx closing as requested
_TOGGLE state has been removed by https://git.typo3.org/typo3/typo3/-/commit/1fa0a832509f6bfa91352bc1a7a0a9b13b69079c and FlexFormTools has been heavily rewritten since v13.