Bug #101190
Updated by Friedemann Altrock over 1 year ago
h3. h2. 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@. h3. h2. 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. h3. h2. 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":https://github.com/TYPO3/typo3/commit/0d77450b9f0232f4ccfd45233b4753146fa71a01#diff-14c801838f1a6bc6f1eba38298bac62639ae823e3c523cc94498b2aa9f9971c1 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. h3. h2. 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.