#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 0
No change resolves or names this issue in its commit message, and no comment links one.