Bug #52060
closedFlexFormService::convertFlexFormContentToArray(): PHP Warnings when XML is invalid
0%
Description
When passing an invalid XML, the method FlexFormService::convertFlexFormContentToArray() throws the following PHP warnings:
<blockquote>
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
</blockquote>
Instead, it should log the original XML Error and return an empty array(). (This would have helped debugging issues like #51907).
<b>Technical Details</b>
\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.
Files