Issue Bug Rejected

#96466RTE parse func paragraph duplication bug

Lars Peter Søndergaard 01/05/22, 15:34 updated 02/07/26, 08:14

Description

While having to deal with imported HTML from an external service, I encountered this odd Bug where, when a Text is followed by a line break and then followed by a self-closing p-tag, the previous text somehow gets duplicated in the output.

An example looks like this (in my case the html comes from a variable, but works the same):

<f:format.html>This is a weird TYPO3 Duplication Bug
<p/></f:format.html>

The “This is a weird TYPO3 Duplication Bug” text get’s duplicated in the output.

I encountered it in TYPO3 9, but could confirm this behaviour in 10 and up to 11.5.4 as well.

I understand that a self-closing p-tag is not really proper html5, but I’d presume any other behaviour would be preferred over this duplication thing.

Greetings

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 6

  1. Riccardo De Contardi commented <span data-processor="relativetime" data-value="2024-06-23T16:16:44+00:00" > 06/23/24, 16:16 </span>

    This is still reproducible on TYPO3 13.2.0-dev (latest main)

    Steps to reproduce

    1) on a page, create a “Text” CE, take note of its uid
    2) Open the DB, go on the tt_content table, identify the record created at point 1
    3) On the bodytext field paste

    This is a weird TYPO3 Duplication Bug
    <p/>

    4) Clear cache and visit the page

    Result:

    the line has been duplicated; the actual HTML is:

    <p>This is a weird TYPO3 Duplication Bug</p>
    <p></p><p>This is a weird TYPO3 Duplication Bug</p>

    On the database, the content is still the one inserted at point 3.
    If you open the CE on TYPO3 backend you will actually see some empty paragraphs including the one that would have contained the second phrase… if you save the CE (even without editing it) the frontend HTML will be “adjusted” with just the empty paragraphs

  2. Benni Mack commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2024-12-12T17:47:29+00:00" > 12/12/24, 17:47 </span>

    I get the message: “Error: Not all tags were closed!” At least in v13.

  3. Riccardo De Contardi commented <span data-processor="relativetime" data-value="2024-12-13T16:27:13+00:00" > 12/13/24, 16:27 </span>

    I am still able to reproduce the issue on TYPO3 13.4.2, I’ll explain in more detail my test procedure:

    1) create a page and create a “Text” CE
    2) Save and close it; take note of its uid
    3) Open the DB with a tool (I use Sequel ACE), go on the tt_content table, identify the record created at point 1
    4) On the bodytext field paste

    This is a weird TYPO3 Duplication Bug
    <p/>

    4) Do not open the content element! Clear all caches
    5) visit the page on the frontend

    result:

    on the frontend, the line is duplicated and the HTML text is actually

        <p>This is a weird TYPO3 Duplication Bug</p>
    <p></p><p>This is a weird TYPO3 Duplication Bug</p>

    On the database, the content is still the one inserted at point 4.

    If you open the CE on TYPO3 backend you will actually see some empty paragraphs including the one that would have contained the second phrase: inspecting the content of bodytext with the “source” CKeditor button you’ll see:

    <p>
        This is a weird TYPO3 Duplication Bug
    </p>
    <p>
        &nbsp;
    </p>
    <p>
        &nbsp;
    </p>

    if you save the CE (even without editing it) the frontend HTML will be “adjusted” and is identical to the HTML inside the CKeditor, with the empty paragraphs. The database is updated, too.

    Please note that if the content on the database (point 4) is:

    This is a weird TYPO3 Duplication Bug<p/>

    with the closing unmatched </p> on the same line instead of on a new line

    then the duplication does not occur! And the resulting HTML is

    <p>This is a weird TYPO3 Duplication Bug</p><p></p>

    before saving; and

        <p>This is a weird TYPO3 Duplication Bug</p>
    <p>&nbsp;</p>

    after saving

  4. Georg Ringer commented and changed status Needs Feedback Rejected <span data-processor="relativetime" data-value="2026-02-07T08:14:27+00:00" > 02/07/26, 08:14 </span>

    Hey!

    as already pointed out by yourself (reference https://html.spec.whatwg.org/multipage/syntax.html#void-elements) the <p> tag is not a self closing tag. parsing html is already not a good thing and there won’t be any effort to support wrong HTML. therefore closing the issue