Bug #101190
closedRteHtmlParser does not properly reset between multiple invocations with different configurations
100%
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.