#109782parseFunc return wrong html in case of remap
Description
I was trying to play with ckeditor and lib.parseFunc_RTE, and i notice a bug when using remap (https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/HtmlparserTags.html#remap)
I tried to remap blockquote as div
lib.parseFunc_RTE {
externalBlocks {
blockquote {
callRecursive.tagStdWrap.HTMLparser = 1
callRecursive.tagStdWrap.HTMLparser {
tags.blockquote.remap = div
}
}
}
}
In my RTE, i had html similar to this
<p>Paragraph 1</p>
<blockquote>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
</blockquote>
<p>Paragraph 4</p>
Then in front, i ended up with this wrong html
<p>Paragraph 1</p>
<div>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 4</p>
</div>
After some digging i found the problem comes from https://github.com/TYPO3/typo3/blob/e7c2bebe29af01996a47b0136d2b39730c68975f/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L2903
if (is_array($cfg[‘callRecursive.’][‘tagStdWrap.’] ?? false)) {
$tag = $this->stdWrap($tag, $cfg[‘callRecursive.’][‘tagStdWrap.’]);
}
$parts[$k] = $tag . $parts[$k] . ‘</’ . $tagName . ‘>’;
Here, $tag is remapped from blockquote to div , but $tagName , use to make the closing tag, is still blockquote
Generated html is then
<p>Paragraph 1</p>
<div>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
</blockquote>
<p>Paragraph 4</p>
And so ended up getting “wrongly fixed” later in the process with the removal of </blockquote> , and addition of </div> in the very end of the bloc
If would fix it like this
if (is_array($cfg[‘callRecursive.’][‘tagStdWrap.’] ?? false)) {
$tag = $this->stdWrap($tag, $cfg[‘callRecursive.’][‘tagStdWrap.’]);
// Refresh tag name in case of remap
$tagName = strtolower($htmlParser->getFirstTagName($tag));
}
$parts[$k] = $tag . $parts[$k] . ‘</’ . $tagName . ‘>’;Reviews 2
Files 6
History 38
-
Gerrit Code Review pushed patch set 1 for main to change 94008 status
NewUnder Review <span data-processor="relativetime" data-value="2026-05-06T14:27:42+00:00" > 05/06/26, 14:27 </span> -
Sebastien Convers commented and changed attached rte_1.png attached rte_source.png attached result_1.png attached wrong_html.png attached result_fix.png attached html_fix.png <span data-processor="relativetime" data-value="2026-05-27T07:07:53+00:00" > 05/27/26, 07:07 </span>
Test case : remap “ -
Gerrit Code Review pushed patch set 2 for main to change 94008 <span data-processor="relativetime" data-value="2026-05-27T08:36:19+00:00" > 05/27/26, 08:36 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 94008 <span data-processor="relativetime" data-value="2026-05-27T08:46:04+00:00" > 05/27/26, 08:46 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 94008 <span data-processor="relativetime" data-value="2026-06-16T09:41:15+00:00" > 06/16/26, 09:41 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 94535 <span data-processor="relativetime" data-value="2026-06-19T10:22:21+00:00" > 06/19/26, 10:22 </span>
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-06-19T12:20:09+00:00" > 06/19/26, 12:20 </span>Applied in changeset commit:ad3cda0b8698c0a79f7b257d02e23fb0e060b5b0.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-08-11T08:47:00+00:00" > 08/11/26, 08:47 </span>