diff --git a/typo3/sysext/core/Classes/Html/RteHtmlParser.php b/typo3/sysext/core/Classes/Html/RteHtmlParser.php index 30a8158c091c326f8565f62ad47e37f153a79e21..c53d497d5a043c07f803987da35f543b13d9432d 100644 --- a/typo3/sysext/core/Classes/Html/RteHtmlParser.php +++ b/typo3/sysext/core/Classes/Html/RteHtmlParser.php @@ -138,6 +138,8 @@ class RteHtmlParser extends HtmlParser implements LoggerAwareInterface protected function setProcessingConfiguration(array $processingConfiguration): void { $this->procOptions = $processingConfiguration; + $this->getKeepTags_cache = []; + if (isset($this->procOptions['allowedClasses.'])) { $this->allowedClasses = (array)$this->procOptions['allowedClasses.']; } else { diff --git a/typo3/sysext/core/Tests/Unit/Html/RteHtmlParserTest.php b/typo3/sysext/core/Tests/Unit/Html/RteHtmlParserTest.php index 8f797541915df42fafbffaf9fbe04cd859eb3c8c..33258fdf9c00ae95d467afcaa3882d163c5e8710 100644 --- a/typo3/sysext/core/Tests/Unit/Html/RteHtmlParserTest.php +++ b/typo3/sysext/core/Tests/Unit/Html/RteHtmlParserTest.php @@ -760,4 +760,25 @@ class RteHtmlParserTest extends UnitTestCase self::assertEquals('<figure class="table">' . CRLF . '<table>Allowed outside of p-tag</table>' . CRLF . '</figure>', $subject->transformTextForRichTextEditor('<figure class="table">' . CRLF . '<table>Allowed outside of p-tag</table>' . CRLF . '</figure>', $this->procOptions)); self::assertEquals('<figure class="table">' . CRLF . '<table>Allowed outside of p-tag</table>' . CRLF . '<figcaption>My Logo</figcaption></figure>', $subject->transformTextForRichTextEditor('<figure class="table">' . CRLF . '<table>Allowed outside of p-tag</table>' . CRLF . '<figcaption>My Logo</figcaption></figure>', $this->procOptions)); } + + /** + * @test + */ + public function resetsAllowTagsWhenProcessingConfigurationChanges(): void + { + $eventDispatcher = $this->createMock(EventDispatcherInterface::class); + $subject = new RteHtmlParser($eventDispatcher); + $input = '<remove>Foo</remove><keep>Bar</keep>'; + $transformed = 'Foo<keep>Bar</keep>'; + $result = $subject->transformTextForPersistence($input, [ + 'mode' => 'default', + 'allowTags' => 'keep', + ]); + self::assertEquals($transformed, $result); + $result = $subject->transformTextForPersistence($input, [ + 'mode' => 'default', + 'allowTags' => 'keep,remove', + ]); + self::assertEquals($input, $result); + } }