Actions
Feature #78560
openLoosen restrictions on tagnames in GeneralUtility::array2xml
Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2016-11-03
Due date:
% Done:
0%
Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:
Description
GeneralUtility::array2xml is very restrictive when it comes to tagnames. Currently only alphanumeric characters, '-' and '_' are allowed in tagnames which makes working with FlexForms or namespaced XML impossible (because '.' and ':' are discarded).
The following line is responsible for the restriction:
// The tag name is cleaned up so only alphanumeric chars (plus - and _) are in there and not longer than 100 chars either. $tagName = substr(preg_replace('/[^[:alnum:]_-]/', '', $tagName), 0, 100);
There are multiple ways this could be handled in the future:
1. Lift restriction to match the W3 XML spec: https://www.w3.org/TR/2008/REC-xml-20081126/#NT-Name ( potentially breaking )
2. Add an option to explicitly allow certain characters. The resulting call could look like this:
GeneralUtility::array2xml($array, $NSprefix, $level, $docTag, $spaceInd, [ 'allowInTagName' => ['.', ':'] ]);
Actions