Bug #105131
closed
Reference Index Updater throws PHP warnings
Added by Philipp Idler about 2 months ago.
Updated about 2 months ago.
Category:
FormEngine aka TCEforms
Description
We encounter a lot of these entries in our syslog table with configured Reference Index Updater Command:
Core: Error handler (BE): PHP Warning: Undefined array key "sheets" in xyz/vendor/typo3/cms-core/Classes/Configuration/FlexForm/FlexFormTools.php line 761
Taking a deeper look to figure out what's going on, I came across Reference Index Updater is checking every flexform data (pi_flexform column in tt_content table) to check references.
Somehow the FlexFormTools traverseFlexFormXMLData method expects 'sheets' key in XML's structures.
I couldn't find any 'sheets' node in my whole database for column pi_flexform - having a lot of plugins and custom CEs with various flexform use cases.
So my conclusion is that this may be a bug in FlexFormTools traverseFlexFormXMLData method.
Correction: not the pi_flexform field is checked rather defined flexform data structure file.
Anyway, at least accessing 'sheets' key which may not exist should be fail-safe
if (!is_array($dataStructureArray['sheets'] ?? null)) {
- Related to Task #102229: Remove FlexFormTools traverser added
- Category changed from CLI to FormEngine aka TCEforms
- Status changed from New to Needs Feedback
Thank's for your support Garvin!
Some flexforms DS in my TYPO3 installation consist only of one sheet, so there is no <sheets> node like the one example file in your first link (DataStructureOfSingleSheet.xml). And that's the cause why mentioned PHP warning is thrown when such flexform DS files are processed by the traverse-function.
I understand that this is a huge task to backport refactored code from v13 to v12 - that's not in my mind either.
The typ3-check (!is_array) is already included in the code - I just added the part to omit PHP warning if key is not set in that array. The code afterwards wouldn't be executed with or without this change.
I see, thanks for getting back so quickly. :) So you tried a patch and that seems to work with your installation, do I understand right?
If so, would you like to contribute the patch and we could see to get it into the v12 version then, if you feel confident that it's just a small type-safety check?
- Status changed from Needs Feedback to Under Review
While refactoring FlexFormTools to work with single and multi sheet flexform DS, I figured out that this job is already done in GeneralUtility:xml2Array method.
I took another round in debugging with my database and focus on CE's with flexform which trigger those PHP warnings, disovering one CE's with invalid flexform DS - missing <T3DataStructure> node at the beginning of file. By adding this node the reference indexer ran through all content without a single warning.
So this issue is solved and not a single line of code had to be touched.
- Status changed from Under Review to Closed
Happy to hear that, thanks for reporting back! :-)
Also available in: Atom
PDF