Project

General

Profile

Actions

Feature #78560

open

Loosen restrictions on tagnames in GeneralUtility::array2xml

Added by Johannes Hertenstein about 8 years ago. Updated over 5 years ago.

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 #1

Updated by Tymoteusz Motylewski about 8 years ago

  • Category set to FormEngine aka TCEforms
Actions #2

Updated by Markus Klein over 6 years ago

  • Tracker changed from Bug to Feature
  • Category changed from FormEngine aka TCEforms to Backend API

I suggest option two. Add an additional configuration option. Feel free to push a patch.

Actions #3

Updated by Benni Mack over 5 years ago

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.

Actions

Also available in: Atom PDF