Project

General

Profile

Actions

Bug #95580

open

Wrong ConfigurationManager in Frontend Ajax call

Added by Markus Pircher over 2 years ago. Updated 11 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2021-10-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I use in some of my extension Ajax calls in the frontend, but with TYPO3 11.5 I got the error message that my controller is not allowed for the extension.

After some searching I have found that Configuration uses the BackendConfigurationManager instead the FrontendConfigurationManager.

I did not find anything if I have to change something in my configuration, or if it's a bug.

The typoscript configuration looks like:


lib.tx_myextension.conf = USER
lib.tx_myextension.conf {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    extensionName = MyExtension
    pluginName = Pi1
    vendorName = MyVendor

    settings < plugin.tx_myextension.settings
}

tx_myextension_ajaxCall = PAGE
tx_myextension_ajaxCall {
    typeNum = 424342
    config {
        disableAllHeaderCode = 1
        disablePrefixComment = 1
        xhtml_cleaning = 0
        no_cache = 1
        replace = 1
    }
    10 < lib.tx_myextension.conf
}


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #96371: Strange error with custom Frontend AuthenticationService in TYPO3 11 TLSClosed2021-12-16

Actions
Actions #1

Updated by Markus Pircher over 2 years ago

Seems to have another reason: #96371

Actions #2

Updated by Benni Mack about 2 years ago

  • Related to Bug #96371: Strange error with custom Frontend AuthenticationService in TYPO3 11 TLS added
Actions #3

Updated by Christin Gmeiner about 2 years ago

This is also a serious problem when using an early frontend middleware which uses extbase repositories (injected through DI).
If the middleware is executed before typo3/cms-frontend/prepare-tsfe-rendering then the global Request Object $GLOBALS['TYPO3_REQUEST'] is not set and therefore the Backend Configuration Manager is used.

This should be fixed, especially if the middleware is created explicitely as frontend middleware, the configuration manager should then resolve to the frontend configuration manager.

The main problem is that the $GLOBALS['TYPO3_REQUEST'] object is set too late (in PrepareTypoScriptFrontendRendering middleware). Currently, I overcome this problem with a 'helper' middleware registered early in the frontend, which sets the request object:

   public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $GLOBALS['TYPO3_REQUEST'] = $request;

        return $handler->handle($request);
    }

Actions #4

Updated by Andreas Wolf 11 months ago

@Christin Gmeiner I can confirm that this fix works, I just implemented it myself and now the FE plugin (from EXT:solr) is working as expected.

Actions

Also available in: Atom PDF