Project

General

Profile

Actions

Bug #101190

closed

RteHtmlParser does not properly reset between multiple invocations with different configurations

Added by Friedemann Altrock over 1 year ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2023-06-28
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

The situation

A record has multiple RTE-enabled text fields, with different RTE configurations.
One of those configurations specifies a different processing, say by adding a tag to allowTags.

The symptom

Depending on the order of the fields, the additionally allowed tag will either be correctly saved to the database, or escaped to HTML entities.

Why?

The allowed tags are cached in the getKeepTags_cache property.
This cache is unchanged from the first field's transformation when the second RTE field is processed for the database.

This patch from November 2019 added TYPO3\CMS\Core\Html\RteHtmlParser as a service for dependency injection.

The DataHandler instantiates an RTE parser for each field through GeneralUtility::makeInstance, which checks the DI container.
All services are effectively singletons.
That means all properties stick around between invocations.

The fix

\TYPO3\CMS\Core\Html\RteHtmlParser::setProcessingConfiguration should properly clear the getKeepTags_cache property.
It is computed from procOptions and should be cleared when procOptions changes.

I have found this issue on TYPO3 11.5.28 with PHP 8.1.20, but as this code has not changed in a while, I guess it affects every version since 10.2.

Actions #1

Updated by Friedemann Altrock over 1 year ago

  • Description updated (diff)
Actions #2

Updated by Gerrit Code Review about 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80695

Actions #3

Updated by Friedemann Altrock about 1 year ago

A reproduction is available here: https://github.com/fwg/typo3-bugs/tree/forge/101190

Actions #4

Updated by Gerrit Code Review about 1 year ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80832

Actions #5

Updated by Gerrit Code Review about 1 year ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80833

Actions #6

Updated by Anonymous about 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #7

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF