Issue Bug Closed

#83548TYPO3 9.0.0 Extbase: Validation in Controller Actions are broken

Alex Kellner 01/12/18, 20:15 updated 01/12/18, 21:24

Description

I’m facing an issue in powermail in TYPO3 9 together with validation of controller actions.
Submitting forms are leading to an exception:

#1239853109: Invalid validate annotation in In2code\Powermail\Controller\FormController->createAction(): Could not resolve class name for validator "mail".

Like it’s described in https://docs.typo3.org/typo3cms/ExtbaseFluidBook/9-CrosscuttingConcerns/2-validating-domain-objects.html#validating-of-controller-arguments it should be possible to validate an action like
@validate $param Path/To/Validator

Debugging extbase leads to a refactored method in \TYPO3\CMS\Extbase\Reflection\ReflectionService::getMethodTagsValues() (which is called from \TYPO3\CMS\Extbase\Validation\ValidatorResolver::getMethodValidateAnnotations())

While the old one returns a correct array:

[
param => [...]
validate => ['$mail In2code\Powermail\Domain\Validator\UploadValidator']
return => [...]
]

The new one does the same but without a leading $:

[
param => [...]
validate => ['mail In2code\Powermail\Domain\Validator\UploadValidator']
return => [...]
]

Hacking it and adding a $ seems to solve the problem.

—-

TYPO3 9.0.0 – installed a day ago via

composer require typo3/minimal

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.