Bug #88374

[xxx in tree.rootLineIds] TypoScript condition causes page cache regeneration on each request

Added by Dima Nozdrin over 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-05-16
Due date:
% Done:

100%

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

Description

For example condition

[123 in tree.rootLineIds]
...
[END]

will cause page cache regeneration on each load for all pages that contain 123 in their rootline.
Tested on TYPO3 9.5.7

The issue can be may tracked in

TypoScriptFrontendController::createHashBase

The condition is not taken into account in
$this->all['matches']
while calculating hash in order to fetch page caches.
As a result cache-hash of the page that is being loaded is not equal the cache that was created for this page before.


Files

2019-05-16--15-10-19.png (94.6 KB) 2019-05-16--15-10-19.png cache regenerated Dima Nozdrin, 2019-05-16 14:22
2019-05-16--15-10-03.png (95.1 KB) 2019-05-16--15-10-03.png cache created the first time Dima Nozdrin, 2019-05-16 14:22

Related issues

Related to TYPO3 Core - Feature #85829: Implement symfony expression language for TypoScript conditionsClosedFrank Naegler2018-08-13

Actions
Has duplicate TYPO3 Core - Bug #86837: TypoScript Condition: tree.* broken on cached pagesClosed2018-11-02

Actions
#1

Updated by Dima Nozdrin over 2 years ago

  • Subject changed from [xxx in tree.rootLineIds] causes page cache regeneration on each request to [xxx in tree.rootLineIds] TypoScript condition causes page cache regeneration on each request
#2

Updated by Dima Nozdrin over 2 years ago

  • Target version set to Candidate for patchlevel
#3

Updated by Dima Nozdrin over 2 years ago

The reason of the issue is the fact that condition does not match even if it should. The right part of the conditions is not evaluated to a correct array of ids.
While rootline data is set by setRootline() method in

TYPO3\CMS\Core\TypoScript\TemplateService::matching()

rootLineIds are fetched only in

TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher

constructor

#4

Updated by Dima Nozdrin over 2 years ago

  • Target version deleted (Candidate for patchlevel)
  • Private changed from No to Yes
  • Complexity set to hard
#5

Updated by Dima Nozdrin over 2 years ago

  • Private changed from Yes to No
#6

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

#7

Updated by Dima Nozdrin over 2 years ago

  • Related to Feature #85829: Implement symfony expression language for TypoScript conditions added
#8

Updated by Dima Nozdrin over 2 years ago

  • Complexity changed from hard to easy
#9

Updated by Markus Klein over 2 years ago

Technical problem description

The code dealing with data coming from cache instantiates the ConditionMatcher and calls the setter to pass along the rootline loaded from cache to the matcher. This code is in place since a long time.
https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php#L1625
calls
https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/TypoScript/TemplateService.php#L387

With the introduction of the new ConditionMatcher the code inside the matcher has been adjusted to initialize the internal rootline stuff within the constructor.
https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/frontend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php#L45
Specifically the expressionLanguageResolver receives the rootline information.
At this point the rootline is fetched from $GLOBALS['TSFE']->tmpl->rootLine which is empty in case a page is coming from cache.
Unfortunately it has been forgotten to re-initialize the expressionLanguageResolver if the rootline inside the condition matcher is modified via the setRootline method.

This causes the described issue here, as the condition matcher has no clue about the current rootline and hence the conditions don't match.

#10

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

#11

Updated by Gerrit Code Review over 2 years ago

Patch set 3 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/+/60771

#12

Updated by Gerrit Code Review over 2 years ago

Patch set 4 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/+/60771

#13

Updated by Gerrit Code Review over 2 years ago

Patch set 5 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/+/60771

#14

Updated by Gerrit Code Review over 2 years ago

Patch set 6 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/+/60771

#15

Updated by Dima Nozdrin over 2 years ago

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

Updated by Gerrit Code Review over 2 years ago

  • Status changed from Resolved to Under Review

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

#17

Updated by Gerrit Code Review over 2 years ago

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

#18

Updated by Gerrit Code Review over 2 years ago

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

#19

Updated by Dima Nozdrin over 2 years ago

  • Status changed from Under Review to Resolved
#20

Updated by Daniel Siepmann about 2 years ago

  • Has duplicate Bug #86837: TypoScript Condition: tree.* broken on cached pages added
#21

Updated by Benni Mack almost 2 years ago

  • Status changed from Resolved to Closed
#22

Updated by Wiebke Lauke over 1 year ago

Hi folks,

that bug still exists in TYPO3 9.5.13.
The following condition works fine in Application Context "Development" (no cache) but doesn't work in Application Context "Production" (caching).

[123 in tree.rootLineIds]
# add a class to body tag
[GLOBAL]

Can anyone reopen this ticket?

Thanks,
Wiebke

Also available in: Atom PDF