Bug #88572

ConfigurationManager returns wrong configuration

Added by Michael Stopp over 1 year ago. Updated 7 months ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2019-06-17
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

My (simplified) page tree looks something like this:

[0]
 ├─[1] Root Page Site A
 │  ├─[2] Page 1
 │  └─[3] Root Page Site B
 │
 └─[4] Root Page Site C
    └─[5] MyExt Plugin

This is the configuration for these pages:

[1] Root TS template, site configuration
[3] Root TS template (clear setup + constants NOT set), site configuration
[4] Root TS template (includes static template for MyExt), site configuration
[5] Plugin flexform has an itemsProcFunc which requires a TS setting

In the itemsProcFunc I try to read the TS for MyExt like this:

$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$configurationManager = $objectManager->get(ConfigurationManager::class);
$tsConf = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);

But this didn't give me the TS for MyExt. However, when I added the static template to [1], I did get the TS for MyExt.
I then debugged $configurationManager and noticed the following, when opening the plugin flexform:

concreteConfigurationManager => TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager
currentPageId => 3 (integer)

The currentPageId doesn't make any sense. But at least it explains, why I'd get the TS for MyExt after adding the static template to page uid [1]...
The Extbase controller of the plugin on [5] gets the correct TS settings. In the TS object browser I get the correct TS configuration when standing on [5]. It's only in the itemsProcFunc, where things seem to go wrong.
I have used this kind of function many times before (T3 < V9) without any problems, but never with site configurations.


Related issues

Related to TYPO3 Core - Feature #90429: ConfigurationManager should offer a way to define the site it is fetching a configuration for Needs Feedback 2020-02-19
Related to TYPO3 Core - Task #54813: BackendConfigurationManager figures out wrong pid Closed 2014-01-07

History

#1 Updated by Gerrit Code Review 8 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/+/63637

#2 Updated by Georg Ringer 8 months ago

  • Related to Feature #90429: ConfigurationManager should offer a way to define the site it is fetching a configuration for added

#3 Updated by Georg Ringer 8 months ago

  • Related to Task #54813: BackendConfigurationManager figures out wrong pid added

#4 Updated by Gerrit Code Review 8 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/+/63637

#5 Updated by Stefan Froemken 7 months ago

Hello Michael,

IMO it is wrong to retrieve the TS in BE with Extbase's ConfigurationManager in itemsProcFunc. Please use the TemplateService directly and set ID by yourself instead of using magic of Extbase.

Stefan

#6 Updated by Michael Stopp 7 months ago

Hi Stefan

Ok. Can you give me a hint on how to do that with TemplateService? I had a quick glance into the API reference, but it wasn't immediately clear to me how this would work.

Also available in: Atom PDF