Project

General

Profile

Actions

Bug #52060

closed

FlexFormService::convertFlexFormContentToArray(): PHP Warnings when XML is invalid

Added by Benjamin Pick about 11 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2013-09-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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

fix_52060.patch (1.11 KB) fix_52060.patch (replace placeholder for throwing typo3 notices!) Benjamin Pick, 2013-09-17 10:16
Actions

Also available in: Atom PDF