Project

General

Profile

Actions

Bug #96332

closed

Dependency injection not working for extbase validators

Added by Philipp Thiele over 2 years ago. Updated over 1 year ago.

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

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
extbase,DI
Complexity:
Is Regression:
Sprint Focus:

Description

(Found by testing powermail in TYPO3 version 11.)

In \TYPO3\CMS\Extbase\Mvc\Controller\ActionController->initializeActionMethodValidators() the validators are instantiated by calling

$validatorInstance = GeneralUtility::makeInstance(
                    $validatorDefinition['className'],
                    $validatorDefinition['options']
                );

however, when options for the given validator are empty, the empty array will get passed to GeneralUtility::makeInstance() as the first argument. Therefore, the check for empty constructorArguments will fail in GeneralUtility::makeInstance() and the class will not be instantiated by the DI container.


Related issues 5 (0 open5 closed)

Related to TYPO3 Core - Task #95026: [TASK] Add missing breaking.rst about service injection in Extbase validatorsClosedTorben Hansen2021-08-29

Actions
Related to TYPO3 Core - Task #92238: Avoid usage of object manager in validation related classesClosed2020-09-09

Actions
Related to TYPO3 Core - Task #94451: Avoid ObjectManager in ext:extbaseClosed2021-07-01

Actions
Related to TYPO3 Core - Task #94384: Avoid ObjectManager in remaining ext:form placesClosed2021-06-19

Actions
Related to TYPO3 Core - Task #96998: Streamline Extbase validatorsClosed2022-02-22

Actions
Actions

Also available in: Atom PDF