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
Updated by Benjamin Pick about 11 years ago
- File fix_52060.patch fix_52060.patch added
Tentative fix. A unit test would be good.
Updated by Mathias Schreiber almost 10 years ago
- Target version set to 7.4 (Backend)
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Benni Mack about 9 years ago
- Sprint Focus set to Stabilization Sprint
Updated by Benni Mack about 9 years ago
- Target version changed from 7.5 to 7 LTS
- Sprint Focus deleted (
Stabilization Sprint)
Updated by Marcin Krzyzanowski about 9 years ago
I've done some unit tests with bad xml input structure. No warnings at all.
Is there a chance to see those warnings any other way?
I also wanted to add that I ran above tests with php 5.2.27
Updated by Mathias Schreiber about 9 years ago
- Status changed from New to Closed
can't reproduce on master