From 474640b2795dde86f00201fd2f4859ce0a029c2c Mon Sep 17 00:00:00 2001 From: Nikita Hovratov <nikita.h@live.de> Date: Fri, 30 Jun 2023 23:10:51 +0200 Subject: [PATCH] [BUGFIX] Consider more TMENU a-tag related config for runtime cache Since the swap to LinkResult, the ATagParams and some more attributes are cached independent of different configuration. This is now fixed by adding the following configuration options to the md5 hash: - TMENUITEM: ATagParams - TMENUITEM: additionalParams - TMENU: addParams - TMENU: target Note: Doing this weakens the usefulness of the runtime cache again (especially for old-school TypoScript based menus). Another option would be to add the attributes after the LinkResult generation (how it was done before), but this would bypass possible Event manipulation. Resolves: #100319 Related: #96486 Releases: main, 12.4 Change-Id: I8a0346b5b932f071f9498ddccd7ecceca39deed4 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79672 Tested-by: core-ci <typo3@b13.com> Tested-by: Nikita Hovratov <nikita.h@live.de> Reviewed-by: Nikita Hovratov <nikita.h@live.de> --- .../Menu/AbstractMenuContentObject.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php index c3e8dad87edb..921b6429e941 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php +++ b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php @@ -1200,7 +1200,19 @@ abstract class AbstractMenuContentObject { $runtimeCache = $this->getRuntimeCache(); $MP_var = $this->getMPvar($key); - $cacheId = 'menu-generated-links-' . md5($key . $altTarget . $typeOverride . $MP_var . ((string)($this->mconf['showAccessRestrictedPages'] ?? '_')) . json_encode($this->menuArr[$key])); + $cacheId = 'menu-generated-links-' . md5( + $key + . ($altTarget ?: ($this->mconf['target'] ?? '') . (isset($this->mconf['target.']) ? json_encode($this->mconf['target.']) : '')) + . $typeOverride + . $MP_var + . ($this->mconf['addParams'] ?? '') + . ($this->I['val']['additionalParams'] ?? '') + . ((string)($this->mconf['showAccessRestrictedPages'] ?? '_')) + . (isset($this->mconf['showAccessRestrictedPages.']) ? json_encode($this->mconf['showAccessRestrictedPages.']) : '') + . json_encode($this->menuArr[$key]) + . ($this->I['val']['ATagParams'] ?? '') + . (isset($this->I['val']['ATagParams.']) ? json_encode($this->I['val']['ATagParams.']) : '') + ); $runtimeCachedLink = $runtimeCache->get($cacheId); if ($runtimeCachedLink !== false) { return $runtimeCachedLink; -- GitLab