Project

General

Profile

Actions

Bug #93597

closed

Adding a TS template with the runThroughTemplatesPostProcessing hook leads to caching issues

Added by Jigal van Hemert about 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2021-02-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The runThroughTemplatesPostProcessing hook in TemplateService is used to add a 'virutal' TS template (based on page properties).

In runThroughTemplates() each sys_template record also adds an item to the rowSum array (happens inside processTemplate() ).
After caches are cleared a hash from rowSum is used as key for caching all conditions. A hash of all matched conditions is used as key for caching all constants and setup.

If two pages only differ in the TS that the hook subscriber adds they will both get the same constants and setup from the cache (rowSum is equal and the same result from the conditions leads to the same key for the constants/setup cache).

If the hook subscriber could add items to rowSum the cache key would be different for both pages.

Example

Situation in site:

+-- start   <-- virtual TS added: "property=1" 
  +-- page1
  +-- page2  <-- virtual TS added: "property=2" 
  |  +-- page2.1
  |  +-- page2.2
  +-- page3

If you clear caches, visit page1 first the TS constants and setup are stored in cache. If you visit page2 (or a subpage) after that the rowSum matches, the conditions are the same and thus the constants and setup from page1 are loaded from cache and used for page2 (and subpages).
If you clear caches, visit page2 first that configuration will be used

Actions #1

Updated by Jigal van Hemert about 3 years ago

  • Description updated (diff)
Actions #2

Updated by Gerrit Code Review about 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68153

Actions #3

Updated by Gerrit Code Review about 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68153

Actions #4

Updated by Gerrit Code Review about 3 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68123

Actions #5

Updated by Jigal van Hemert about 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Benni Mack almost 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF