Skip to content

PDF/document generation loses line breaks when text contains < or > characters #38919

@anthonyvdberghe

Description

@anthonyvdberghe

Bug

After upgrading to Dolibarr 23.0.3, text formatting in generated documents/PDFs seems to break when a free text field contains the characters < or >.

When these characters are used in multiline descriptions, for example in intervention lines, proposals or invoices, the generated PDF no longer preserves the line breaks correctly. The characters also seem to be interpreted, encoded or stripped inconsistently, possibly because they are treated as HTML/XML markup delimiters.

The issue was reproduced on an intervention document, but similar behavior is reported in proposals, intervention sheets, invoices and other generated documents.

Dolibarr Version

23.0.3

Environment PHP

PHP 8.3.31

Environment Database

MariaDB 10.11.18

Steps to reproduce the behavior and expected behavior

Create or edit an intervention line, proposal line, invoice line or another document line with a multiline description.
Add text containing the characters < or >.

Example input:

Price changes:
Gentse stoverij: from €2.00 > €2.50
Chateaubriand Natuur: from €2.50 > €3.00
Rundstataki: from €4.00 > €4.50

Save the line.
Generate the PDF/document.
Open the generated PDF.

Expected behavior:

The generated PDF should preserve the original multiline formatting and display < and > as normal text characters.

Example expected output:

Price changes:
Gentse stoverij: from €2.00 > €2.50
Chateaubriand Natuur: from €2.50 > €3.00
Rundstataki: from €4.00 > €4.50

Current output:
Price changes:Gentse stoverij: from €2.00 > €2.50Chateaubriand Natuur: from €2.50 > €3.00Rundstataki: from €4.00 > €4.50

Attached files

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis is a bug (something does not work as expected)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions