Skip to content

html special characters in variables break PDF output #261

@liayn

Description

@liayn

Describe the bug

Consider this template and firstName having the content M<a:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      xmlns:pdf="http://typo3.org/ns/Bithost/Pdfviewhelpers/ViewHelpers"
      data-namespace-typo3-fluid="true"
>
<pdf:document title="TestCertificate" outputPath="{outputPath}" outputDestination="F">
    <pdf:page>
        <pdf:html>{firstName}</pdf:html>
        <pdf:text>{firstName}</pdf:text>
    </pdf:page>
</pdf:document>
</html>

This results in a PDF, which only contains an M because the < character in the variable breaks the output.

The reason is that the escaping configuration of the viewhelpers is wrong. Escaping must only be turned off for content viewhelpers not dealing with HTML.

Environment
TYPO3 version(s): v12
pdfviewhelpers version: 3.1.1

Expected behavior

The output should contain the variable's content correctly within the HTML and the TEXT block.

Possible solution

Configure escaping of output and children correctly in viewhelpers.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions