Project

General

Profile

Actions

Bug #94150

closed

Constants in Page TsConfig with multiple sites, caching problem

Added by Marco Huber over 3 years ago. Updated about 3 years ago.

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

100%

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

Description

I think there is a problem with caching in \TYPO3\CMS\Core\Configuration\Parser\PageTsConfigParser, because it doesn't use the current site config in the cache identifier.

My test case with two sites:

config/sites/site-a/config.yaml:

rootPageId: 1
settings:
  access:
    groupid: 1

config/sites/site-b/config.yaml:

rootPageId: 2
settings:
  access:
    groupid: 2

Page TsConfig:

TCEMAIN {
  permissions {
    groupid = {$access.groupid}
  }
}

Clear the cache and then open the info modul and have a look at the page tsconfig for site-a, then {$access.groupid} is replaced with "1". But on site-b {$access.groupid} is not replaced.
Clear the cache again and open site-b first. Now {$access.groupid} is replaced on site-b with "2" but not on site-a.
Another test is to create pages and check the access rights in the Access module. The first site has the group set, the second site has no group set.

The related code should be in PageTsConfigParser:parse(). If I change `$hashOfContent = md5('PAGES:' . $content);` to `$hashOfContent = md5('PAGES:' . $content) . ($site ? $site->getIdentifier() : '');` then it works. But I'm not sure, if this is the best solution. I tested with 10.4 but the code in master is still the same. So the problem should exist there, too.

As a hotfix without changing the core an integrator can use good old conditions in the page TsConfig :-)

[1 in tree.rootLineIds]
TCEMAIN {
  permissions {
    groupid = 1
  }
}
[GLOBAL]
[2 in tree.rootLineIds]
TCEMAIN {
  permissions {
    groupid = 2
  }
}
[GLOBAL]


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Feature #91080: Populate site settings to TypoScript constantsClosedBenni Mack2020-04-17

Actions
Related to TYPO3 Core - Feature #91081: Populate site settings to TSconfigClosedBenni Mack2020-04-17

Actions
Related to TYPO3 Core - Bug #92528: TypoScript site constants not always populatedClosed2020-10-09

Actions
Actions #1

Updated by Marco Huber over 3 years ago

  • Related to Feature #91080: Populate site settings to TypoScript constants added
Actions #2

Updated by Marco Huber over 3 years ago

Actions #3

Updated by Marco Huber over 3 years ago

  • Related to Bug #92528: TypoScript site constants not always populated added
Actions #4

Updated by Marco Huber over 3 years ago

Instead of modifying $hashOfContent perhaps it would be better to do the Constants stuff in the beginning of the parse function before checking the cache. I think in \TYPO3\CMS\Core\TypoScript\TemplateService the Constants are replaced very early, too.

Actions #5

Updated by Gerrit Code Review over 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/+/69175

Actions #6

Updated by Gerrit Code Review over 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/+/69201

Actions #7

Updated by Marco Huber over 3 years ago

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

Updated by Benni Mack about 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF