#78560Loosen restrictions on tagnames in GeneralUtility::array2xml
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' => ['.', ':'] ]);
Reviews 1
History 56
-
Tymoteusz Motylewski changed category <span data-processor="relativetime" data-value="2016-11-07T20:33:29+00:00" > 11/07/16, 20:33 </span>
-
Markus Klein commented and changed tracker
BugFeature category <span data-processor="relativetime" data-value="2018-02-28T13:56:50+00:00" > 02/28/18, 13:56 </span> -
Benni Mack commented <span data-processor="relativetime" data-value="2019-06-17T08:45:01+00:00" > 06/17/19, 08:45 </span>
Markus Klein wrote:
> I suggest option two. Add an additional configuration option. Feel free to push a patch.I’d go with option 1 and make it “breaking”, I don’t see how this could be breaking though.
-
Georg Ringer changed Sprint Focus On Location Sprint <span data-processor="relativetime" data-value="2025-04-29T06:29:19+00:00" > 04/29/25, 06:29 </span>
-
Georg Ringer changed Sprint Focus
On Location Sprint<span data-processor="relativetime" data-value="2026-08-06T15:48:11+00:00" > 08/06/26, 15:48 </span> -
Gerrit Code Review pushed patch set 1 for main to change 96739 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-15T20:54:52+00:00" > 10/15/26, 20:54 </span>
I suggest option two. Add an additional configuration option. Feel free to push a patch.