Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong ConfigurationManager initialized in TYPO3 v11 #74

Open
r3h6 opened this issue Nov 29, 2022 · 3 comments
Open

Wrong ConfigurationManager initialized in TYPO3 v11 #74

r3h6 opened this issue Nov 29, 2022 · 3 comments

Comments

@r3h6
Copy link

r3h6 commented Nov 29, 2022

The global TYPO3_REQUEST is not yet present in the middleware when the ConfigurationManager gets initialized.
Threfore Extbase can not determine correctly the application mode and the BackendConfigurationManager is loaded.
This leads to issues when using extbase plugins. Extbase doesn't load the plugin configurations...

Quick solution is a middleware which sets the global variable before the rest middleware.

@cundd
Copy link
Owner

cundd commented Nov 30, 2022

Thank you for opening this issue.

Can you tell me a bit more about the impact of this? Does it affect to default CRUD handler and custom handlers?

It looks like you already put some research into this. Could you give me a hint on where this should be set? Maybe as a workaround we could set $GLOBALS['TYPO3_REQUEST'] in RestMiddleware.

@Digi92
Copy link

Digi92 commented Apr 25, 2023

I think he meant the following behavior:
When the middleware "RestMiddleware" is called and it calls the ConfigurationManager via the Rest MiddlewareBootstrap before "$GLOBALS['TYPO3_REQUEST']" is set, which is set by "TypoScriptFrontendInitialization" or "PrepareTypoScriptFrontendRendering".
In the typo3/sysext/extbase/Classes/Configuration/ConfigurationManager.php:47 there are the following If during initialization:

    {
        if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface
            && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend()
        ) {
            $this->concreteConfigurationManager = $this->container->get(FrontendConfigurationManager::class);
        } else {
            $this->concreteConfigurationManager = $this->container->get(BackendConfigurationManager::class);
        }
    }

Because the middleware is listed before the set, the ConfigurationManager loads the BackendConfigurationManager and therefore the settings set by the user cannot be loaded.

Because of this I had an access "Deny" for all my urls.

As a solution I set the variable "$GLOBALS['TYPO3_REQUEST']" in the middleware "RestMiddleware".
I'm unsure if this has any side effects, but so far I couldn't find any.

     {
         if ($this->isRestRequest($request)) {
+            $GLOBALS['TYPO3_REQUEST'] = $request;
             $middlewareBootstrap = new MiddlewareBootstrap();
             $frontendController = $middlewareBootstrap->bootstrapCore($request);
             $languageEnhancedRequest = $middlewareBootstrap->bootstrapLanguage($frontendController, $request);

@cundd
Copy link
Owner

cundd commented Apr 25, 2023

Thank you for the clarification.

I added the code in the v6 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants