Project

General

Profile

Actions

Bug #99764

closed

Repository Injection in Middleware is causing Typo3 v11 to don't find default controller for plugins anymore

Added by Sabrina Zwirner almost 2 years ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2023-01-31
Due date:
% Done:

0%

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

Description

Hello,
i was updating my project from v10 to v11 php8.1 and got the following error for every Plugin that i included:

The default controller for extension "XY" and plugin "XYZ" can not be determined. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.

After testing i found out that the problem was my middleware. It got registeres after 'typo3/cms-frontend/authentication' and before 'typo3/cms-frontend/page-resolver' to create a deeplogin (read out get parameter before the user gets redirected to the login page).

The Problem was that i registered an AccountRepository in the constructor.

/** @var AccountRepository */
protected $accountRepository;

public function __construct(?Context $context = null, ?AccountRepository $accountRepository = null)
{
 $this->context = $context ?? GeneralUtility::makeInstance(Context::class);
 $this->accountRepository = $accountRepository;
}

I also tried to register it with:

$account = GeneralUtility::makeInstance(AccountRepository::class);

but this created the same error.

I realy dont understand why this is now happening in v11 and it looks for me like a bug. It seamed that only when you register the middleware after the 'typo3/cms-frontend/page-resolver' you could fix this issue, but then you cant redirect the user intime before other redirects are happening.

Would be great when this is getting fixed or we find a propper solution for it.

Actions #1

Updated by Jessica Schlierenkamp almost 2 years ago

Hi,
I have the same issue, only that I am trying to inject a Service & not a repository. That service however depends on a repository somewhere down the line, so maybe that is what it comes down to.

Also, I am using PHP 8.0 and not 8.1.

Any help is greatly appreciated. Right now the issue is hindering me from updating to TYPO3 11 & PHP 8 and I don't have a clue where to start to fix it.

Actions #2

Updated by Tim Schellenberg over 1 year ago

This issue still persists in TYPO3 v12, we just spent some time debugging the issue to come to this same conclusion. Middlewares loading Repositories via Dependency Injection causes Extbase to use the BackendConfigurationManager instead of the FrontendConfigurationManager when loading plugin configurations, resulting in empty "controller -> action" mappings where they should not be empty.

Actions #3

Updated by Benni Mack about 1 year ago

Extbase has some really bad dependency constraints (mainly the whole ConfigurationManager part) which we're slowly getting rid of by major version to the next major version. For the time being, we suggest to not use Extbase Repositories or Extbase-related services in a middleware, but instead boot up Extbase via Extbase's Bootstrap as a workaround in v11 + v12.

Actions #4

Updated by Georg Ringer 4 months ago

  • Status changed from New to Closed

closing issue as explained by benni. extbase is not that way to go in CLI

Actions

Also available in: Atom PDF