Invalid ODT generated when tokens contain XML reserved symbols
Overview
The Print/Merge feature creates broken ODT file using an ODT template with tokens if the data contains an ampersand (&). The &
character gets written directly to the content.xml
, therefore creating invalid XML, and therefore an invalid ODT.
Reproduction steps
- Create a contact with
Test & Test
in Adressee. - Create an ODT template containing
{contact.addressee}
. - Open the Print/Merge activity on the previously created contact.
- Select the previously created ODT as template.
- Perform the merge.
Current behaviour
The resulting ODT file is broken.
Expected behaviour
A valid ODT file should be generated (eg. reserved XML symbols should be properly escaped).
Environment information
- CiviCRM: 5.34.0
- PHP: 7.3
- CMS: Drupal 9.1