From 2758aa4faac27ed6ba5fb5eb4b957436a5ba0803 Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Mon, 2 Mar 2020 23:11:12 +0100
Subject: [PATCH] [BUGFIX] Respect content_from_pid in page cache

When using "content_from_pid" and the content from a different
pid is changing, the cache of the frontend page should be affected as well.

Resolves: #82249
Releases: master, 9.5
Change-Id: If62c01e1844e1369fab49db483600c9a6d907099
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63531
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../Classes/Controller/TypoScriptFrontendController.php       | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
index 7c40e41f8d27..7e90e219b4ec 100644
--- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
+++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
@@ -2593,6 +2593,10 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         ];
         $this->cacheExpires = $expirationTstamp;
         $this->pageCacheTags[] = 'pageId_' . $cacheData['page_id'];
+        // Respect the page cache when content of pid is shown
+        if ($this->id !== $this->contentPid) {
+            $this->pageCacheTags[] = 'pageId_' . $this->contentPid;
+        }
         if (!empty($this->page['cache_tags'])) {
             $tags = GeneralUtility::trimExplode(',', $this->page['cache_tags'], true);
             $this->pageCacheTags = array_merge($this->pageCacheTags, $tags);
-- 
GitLab