Review main Ready for review

97610[BUGFIX] Apply HTMLparser_db tag options inside lists and tables

Benni Mack CR +1 V +1 Normal +63 −4 updated 11/13/26, 22:41

Commit message

RteHtmlParser::TS_transform_db() only cleaned the content of
block elements it recurses into, such as <div> or <blockquote>.
Content of all other block elements, e.g. <ul>, <ol>, <table>
or headlines, was stored without passing the HTMLcleaner, so
options like "fixAttrib" had no effect on a link inside a list
item or a table cell.

The options configured per tag in "HTMLparser_db.tags" are now
applied to the content of these block elements as well. Tags
without such a configuration and the text are kept as they are,
so allowTags, denyTags and keepNonMatchedTags still do not alter
this content. Self-closing tags such as <br/> are normalized the
same way as outside of these block elements.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 2
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/10/97610/2 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/10/97610/2 && git cherry-pick FETCH_HEAD

Review

  • Code review CR +1 Needs a vote
    • Simon Schaufelberger +1
  • Verified V +1 Needs a vote
    • Simon Schaufelberger +1
    • core-ci +1 CI

Merge conflicts 1

Issues 1

Files 2

Review log 57

  1. Benni Mack uploaded patch set 1 11/13/26, 11:57

  2. core-ci voted on patch set 1 V +1 11/13/26, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114314

  3. Oli Bartsch commented on patch set 1 11/13/26, 16:21

    RteHtmlParser.php:54

    The extended default tag list has table and dl tags but not h1-h6, so without a dedicated config, `<td><h3>t</h3>` becomes `<td>t`. The list also feeds `getKeepTags('rte')` in `setDivTags()`, and the changed `span` expectation might be behaviour change

    RteHtmlParser.php:403

    default now this skips `<br/>` to `<br />` normalisation, so `<td>x<br/>y</td>` would stored as `<br/ />`. Can we move the normalisation into `cleanHtmlForPersistence()` so both paths share it?

    RteHtmlParser.php:404

    The content of lists, tables, headings etc. now runs through the cleaner with `keepNonMatchedTags`, so markup not in `allowTags` is escaped or removed on re-save. That rewrites stored content, which we IMO shouldn't do in a bugfix.
  4. Benni Mack uploaded patch set 2 V +1 11/13/26, 20:33

  5. Benni Mack commented on patch set 1 11/13/26, 20:34

    RteHtmlParser.php:54 Reply

    Done. The default tag list is no longer changed. Inside blocks that aren't processed recursively, only the per-tag `HTMLparser_db.tags` options are applied now, and all other tags are kept as they are. So `<td><h3>…</h3>` stays intact, and the `span` expectation is back to the original.

    RteHtmlParser.php:403 Reply

    Done. It's now `normalizeSelfClosingTags()`, used by both paths, with a test for `<td>x<br/>y</td>`.

    RteHtmlParser.php:404 Reply

    Done. allowTags, denyTags, keepNonMatchedTags and htmlSpecialChars don't touch the content of these blocks any more. Only tag options the integrator configured explicitly (e.g. fixAttrib) are applied, which is what #102053 asks for.
  6. core-ci voted on patch set 2 V +1 11/13/26, 22:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114392

  7. Simon Schaufelberger voted on patch set 2 CR +1 V +1 11/13/26, 22:41