studiomitte / friendlycaptcha-typo3

Integration of friendly captcha
Other
4 stars 8 forks source link

PowermailValidator misses LANG for error translation #8

Open mueller-sebastian opened 7 months ago

mueller-sebastian commented 7 months ago

An error friendlycaptcha throws an Exception: Return value of StudioMitte\FriendlyCaptcha\FieldValidator\PowermailValidator::getLanguageService() must be an instance of TYPO3\CMS\Core\Localization\LanguageService, null returned

PowermailValidator.php uses $GLOBALS['LANG'] for error translation. It is not available in FE and it is discouraged to use this variable directly (in FE).

https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/Configuration/GlobalVariables.html#confval-LANG

Using translateErrorMessage of TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator like it is used in studiomitte/friendlycaptcha/Classes/FieldValidator/FormValidator.php does work.