Project

General

Profile

Actions

Bug #91742

closed

Fluid view helper asset.script escape children

Added by Roman Büchler over 4 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2020-07-03
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

A variable (e.g. data.bodytext) holds json data. When using it in a fluid asset script view helper the resulting json code is escaped:

<f:asset.script identifier="pp-schema-{data.uid}" type="application/ld+json">
{data.bodytext}
</f:asset.script>

Escaped result:

<script type="application/ld+json">
{
  &quot;@context&quot;:&quot;http://schema.org&quot;,
  &quot;@type&quot;:&quot;Hotel&quot;,

The view helper script has escapeOutput disabled.

When creating a descendent view helper and setting escapeChildren to false the resulting code won't be escaped any more hence the output is as expected. According to the description it shouldn't be needed to disable escapeChildren:

"If escaping of children is disabled, no nodes that are passed with inline syntax or values used as tag content will be escaped. Note that $escapeOutput takes priority: if it is disabled, escaping of child nodes is also disabled unless explicitly enabled."


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #92284: <f:asset.script> ViewHelper double escape the src attributeClosedFrank Nägler2020-09-10

Actions
Actions #1

Updated by Georg Ringer about 4 years ago

  • Related to Bug #92284: <f:asset.script> ViewHelper double escape the src attribute added
Actions #2

Updated by Simon Praetorius over 1 year ago

From my point of view, the actual behavior of this is correct. However, the documentation is unclear. I opened a pull request to fix this:

https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/3129

Actions #3

Updated by Simon Praetorius over 1 year ago

  • Status changed from New to Accepted
Actions #4

Updated by Simon Praetorius over 1 year ago

  • Status changed from Accepted to Resolved

This is now fixed in documentation. You should be able to use f:format.raw or f:format.json (then with array/object) to achieve the desired behavior.

Actions #5

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF