diff --git a/typo3/sysext/core/Classes/Html/RteHtmlParser.php b/typo3/sysext/core/Classes/Html/RteHtmlParser.php index 54078c8452155023a5fe849c8f5233185cfc6ce0..a16f5e21d7d8335683d2c7d75a84b1ca1dc4b062 100644 --- a/typo3/sysext/core/Classes/Html/RteHtmlParser.php +++ b/typo3/sysext/core/Classes/Html/RteHtmlParser.php @@ -119,6 +119,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 f7ea24b92b27f8f339bfdf69ead48960473c8d89..40979236d58b8180dabe178963f2c547419fb7bf 100644 --- a/typo3/sysext/core/Tests/Unit/Html/RteHtmlParserTest.php +++ b/typo3/sysext/core/Tests/Unit/Html/RteHtmlParserTest.php @@ -754,4 +754,25 @@ final 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); + } }