Project

General

Profile

Actions

Bug #71394

closed

GeneralUtility::array2xml(): Empty arrays are encoded as whitespace

Added by Andreas Wolf about 9 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
Start date:
2015-11-07
Due date:
% Done:

100%

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

Description

When encoding an empty array as XML (e.g. an empty Flexform container from which all sections have been removed), the empty array will be encoded as (linebreaks stripped) <el index="el">        </el>. This leads to the object not being treated as an empty array on decoding, but as a nonempty string.

In some situations, such a non-empty string leads to undesirable results, e.g. when passing it to Fluid’s f:for view helper, where it will trigger a warning because it is not iterable.

The root cause can be found in GeneralUtility::array2xml(), where the value of array elements is prepended with indentation no matter the size of the array. Instead, empty elements should be dropped.

In most situations, the type="array" will mitigate the negative effects. For certain Flexform constellations however, this will not be used, making it impossible to resolve the type properly.

Actions

Also available in: Atom PDF