Bug #88374

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

Added by Dima Nozdrin 11 months ago. Updated 2 months ago.

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

100%

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.

2019-05-16--15-10-19.png View - cache regenerated (94.6 KB) Dima Nozdrin, 2019-05-16 14:22

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


Related issues

Related to TYPO3 Core - Feature #85829: Implement symfony expression language for TypoScript conditions Closed 2018-08-13
Duplicated by TYPO3 Core - Bug #86837: TypoScript Condition: tree.* broken on cached pages Closed 2018-11-02

Associated revisions

Revision 6d808707 (diff)
Added by Dima Nozdrin 10 months ago

[BUGFIX] Fix page caching with tree.rootLineIds condition check

Conditions with `tree.rootLineIds` if matched caused page cache
regeneration on each request.

Resolves: #88374
Releases: master, 9.5
Change-Id: I5a9a2a429a80575b654a6894a3515c8ca8ec8db4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60771
Tested-by: TYPO3com <>
Tested-by: Benjamin Kott <>
Tested-by: Andreas Fernandez <>
Reviewed-by: Benjamin Kott <>
Reviewed-by: Andreas Fernandez <>

Revision b36be531 (diff)
Added by Dima Nozdrin 10 months ago

[BUGFIX] Fix page caching with tree.rootLineIds condition check

Conditions with `tree.rootLineIds` if matched caused page cache
regeneration on each request.

Resolves: #88374
Releases: master, 9.5
Change-Id: I5a9a2a429a80575b654a6894a3515c8ca8ec8db4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61000
Reviewed-by: Frank Naegler <>
Reviewed-by: Andreas Fernandez <>
Tested-by: Andreas Fernandez <>
Tested-by: TYPO3com <>

History

#1 Updated by Dima Nozdrin 11 months 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 11 months ago

  • Target version set to Candidate for patchlevel

#3 Updated by Dima Nozdrin 11 months 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 11 months ago

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

#5 Updated by Dima Nozdrin 11 months ago

  • Private changed from Yes to No

#6 Updated by Gerrit Code Review 11 months 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 11 months ago

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

#8 Updated by Dima Nozdrin 10 months ago

  • Complexity changed from hard to easy

#9 Updated by Markus Klein 10 months 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 10 months 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 10 months 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 10 months 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 10 months 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 10 months 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 10 months ago

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

#16 Updated by Gerrit Code Review 10 months 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 10 months 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 10 months 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 10 months ago

  • Status changed from Under Review to Resolved

#20 Updated by Daniel Siepmann 6 months ago

  • Duplicated by Bug #86837: TypoScript Condition: tree.* broken on cached pages added

#21 Updated by Benni Mack 3 months ago

  • Status changed from Resolved to Closed

#22 Updated by Wiebke Lauke 2 months 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