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

Also available in: Atom PDF