Skip to content

[BUGFIX] Don't re-instantiate TypoScript in FE/Search context#4376

Merged
dkd-kaehm merged 1 commit into
TYPO3-Solr:mainfrom
dkd-kaehm:bugfix/4340_do_not_reinstantiate_TS_in_FE
Oct 15, 2025
Merged

[BUGFIX] Don't re-instantiate TypoScript in FE/Search context#4376
dkd-kaehm merged 1 commit into
TYPO3-Solr:mainfrom
dkd-kaehm:bugfix/4340_do_not_reinstantiate_TS_in_FE

Conversation

@dkd-kaehm

@dkd-kaehm dkd-kaehm commented Jul 4, 2025

Copy link
Copy Markdown
Collaborator

Fixes: #4340, #4419

@dkd-kaehm dkd-kaehm force-pushed the bugfix/4340_do_not_reinstantiate_TS_in_FE branch from c3f088b to 6838916 Compare July 4, 2025 09:05
@dkd-kaehm dkd-kaehm force-pushed the bugfix/4340_do_not_reinstantiate_TS_in_FE branch from 6838916 to 0382580 Compare July 25, 2025 14:32
@dkd-kaehm dkd-kaehm force-pushed the bugfix/4340_do_not_reinstantiate_TS_in_FE branch from 0382580 to a349574 Compare September 26, 2025 08:09
@dkd-kaehm

dkd-kaehm commented Sep 26, 2025

Copy link
Copy Markdown
Collaborator Author

@bmack proposed:

--- Classes/System/Configuration/ConfigurationManager.php	2025-07-25 16:35:48
+++ Classes/System/Configuration/ConfigurationManager.php	2025-07-25 16:36:02
@@ -68,7 +68,22 @@
                 }
             }
         }
-        $fullConfig = $this->getCoreTypoScriptFrontendByRequest($request)->getSetupArray();
+        try {
+            $fullConfig = $request->getAttribute('frontend.typoscript')?->getSetupArray();
+        } catch (\RuntimeException) {
+            $fullConfig = null;
+        }
+        if ($fullConfig === null) {
+            $cache = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('hash');
+            $cacheIdentifier = $pageId . '_' . ($request->getAttribute('language')?->getLanguageId() ?? 0);
+            if (!$cache->has($cacheIdentifier)) {
+                // Fallback to full TypoScript configuration
+                $fullConfig = $this->getCoreTypoScriptFrontendByRequest($request)->getSetupArray();
+                $cache->set($cacheIdentifier, $fullConfig);
+            } else {
+                $fullConfig = $cache->get($cacheIdentifier);
+            }
+        }
         return GeneralUtility::makeInstance(TypoScriptConfiguration::class, $fullConfig, $pageId);
     }

@dkd-kaehm dkd-kaehm force-pushed the bugfix/4340_do_not_reinstantiate_TS_in_FE branch 3 times, most recently from 657f380 to 1b6caca Compare October 10, 2025 13:45
@dkd-kaehm dkd-kaehm force-pushed the bugfix/4340_do_not_reinstantiate_TS_in_FE branch from 1b6caca to e2cbfe0 Compare October 10, 2025 18:15
@dkd-kaehm dkd-kaehm marked this pull request as ready for review October 11, 2025 08:53

@dkd-friedrich dkd-friedrich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me after a quick visual check.

@dkd-kaehm dkd-kaehm merged commit 9cd2ddc into TYPO3-Solr:main Oct 15, 2025
10 checks passed
@dkd-kaehm dkd-kaehm deleted the bugfix/4340_do_not_reinstantiate_TS_in_FE branch October 15, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Missing $expressionMatcherVariables on FrontendTypoScriptFactory->createSettingsAndSetupConditions

2 participants