From 27e301f5662a77bffafb5459ef8b18d29527b7dd Mon Sep 17 00:00:00 2001
From: Oliver Hader <oliver@typo3.org>
Date: Thu, 6 Jul 2023 15:41:29 +0200
Subject: [PATCH] [TASK] Clarify iteration for re-processing nested tags

Issue #39261 changed the behavior for processing nested tags.
The iteration is adjusted and commented, to make clear what is
actually happening there... (`$tagConfig` did not have a meaning).

Resolves: #92194
Releases: main, 12.4
Change-Id: I94ddc683bbd1241330cde0d44cb7339afa75da56
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79806
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
---
 .../frontend/Classes/ContentObject/ContentObjectRenderer.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
index 7ecee4a1d3e6..fa50442a5ab5 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
@@ -3340,7 +3340,10 @@ class ContentObjectRenderer implements LoggerAwareInterface
                     // Search for tags to process in current data and
                     // call this method recursively if found
                     if (str_contains($data, '<') && isset($conf['tags.']) && is_array($conf['tags.'])) {
-                        foreach ($conf['tags.'] as $tag => $tagConfig) {
+                        // @todo probably use a DOM tree traversal for the whole stuff
+                        // This iterations basically re-processes the markup string, as
+                        // long as there are `<$tag ` or `<$tag>` "tags" found...
+                        foreach (array_keys($conf['tags.']) as $tag) {
                             // only match tag `a` in `<a href"...">` but not in `<abbr>`
                             if (preg_match('#<' . $tag . '[\s/>]#', $data)) {
                                 $data = $this->parseFuncInternal($data, $conf);
-- 
GitLab