Issue Bug Closed

#96332Dependency injection not working for extbase validators

Philipp Thiele 12/10/21, 18:32 updated 10/04/22, 14:14

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.

Reviews 3