Issue Bug Closed

#52529Bug in GeneralUtility::array2xml

Markus Hölzle 10/04/13, 11:46 updated 10/02/18, 12:10

Description

It is possible to create XML with an empty key, if the array key is an empty string.
This must be checked in \TYPO3\CMS\Core\Utility\GeneralUtility::array2xml in line 260:

instead:

// Add the element to the output string:
$output .= ($spaceInd >= 0 ? str_pad('', ($level + 1) * $indentN, $indentChar) : '') . '<' . $NSprefix . $tagName . $attr . '>' 

this must be:

// Add the element to the output string:
if((string)$tagName !== ''){
   $output .= ($spaceInd >= 0 ? str_pad('', ($level + 1) * $indentN, $indentChar) : '') . '<' . $NSprefix . $tagName . $attr . '>' . $content . '</' . $NSprefix . $tagName . '>' . $nl;
}

Reviews 3