#52060FlexFormService::convertFlexFormContentToArray(): PHP Warnings when XML is invalid
Description
When passing an invalid XML, the method FlexFormService::convertFlexFormContentToArray() throws the following PHP warnings:
PHP Warning: Invalid argument supplied for foreach() in /typo3/sysext/extbase/Classes/Service/FlexFormService.php line 51
PHP Warning: array_values() expects parameter 1 to be array, string given in /typo3/sysext/extbase/Classes/Service/FlexFormService.php line 51
Instead, it should log the original XML Error and return an empty array(). (This would have helped debugging issues like #51907).
Technical Details
\TYPO3\CMS\Core\Utility\GeneralUtility::xml2array() returns a string when an error occurs (e.g. “Line 10: Invalid character …”). So $flexFormArray[‘data’] is interpreted as string access (first character, ‘data’ is coerced into 0). $flexFormArray then is assigned ‘L’, which of course isn’t an array anymore.
This was discovered in 6.1 but should still be present in 6.2 HEAD.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.