[TYPO3-dev] typoscript template.relPathPrefix causes decoding of html-entities in affected attributes

Martin Ficzel martin.ficzel at gmx.de
Mon Oct 22 17:03:07 CEST 2007


I found the following strange behavior of the typoscript template-object:

If relPathPrefix is set the Typoscript-Object TEMPLATE will decode all htmlspecialchars in 
affected attributes. Wich is undocumented behavior and is also different from the default 
behavior of the Template Object.

For writing valid xhtml code you have to mask all entities in attributes. If the decode is 
done the validator will complain about unmasked entities.

I personally sumbled over this by setting a link like this in the template file.

<a href="/index.php?id=foo&amp;L=1">bar</a>

The reason is the method t3lib_parsehtml::prefixResourcePath() wich is calling 
t3lib_parsehtml::get_tag_attributes() with second parameter 1 (enable decoding of 
html-specialchars)

I suggested a patch to bugtracker and corelist but it seems that it needs a little more 
discussion that just the +-1 votes on that list because the change has to be done in 
t3lib/class.t3lib_parsehtml.php and could have side-effects. I want to discuss the isssue 
here to find a proper solution.

Bugtracker references:
http://bugs.typo3.org/view.php?id=6555

My reasons for requesting this change are:

- TEMPLATE should behave the same way independent weather relPathPrefix is set or not
- TYPO3 schould not transform TEMPLATES per default
- masking entities in attributes is needed vor valid xhtml
- double masking can solve the problem but will lead to templates like <a 
href="index.php?id=foo&amp;amp;L=1">... wich is a dirty hack

Other possible solutions:

- document that attributes are decoded if relPathPrefix is set if the behavior is intended
- make the TEMPLATE cObject decode all entities is this really is a feature

The questions i have:

- Does ayone know why t3lib_parsehtml::prefixResourcePath() is decoding the entities?
- Will it have side effects do disable this.
- Wich of the solutions mentioned above seems valid to you.

Regards Martin





More information about the TYPO3-dev mailing list