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.
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
Updated by Friedemann Altrock about 1 year ago
A reproduction is available here: https://github.com/fwg/typo3-bugs/tree/forge/101190
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
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
Updated by Anonymous about 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 476087778903147b07484b1ce28a956116adb3b0.