Issue Bug Closed

#93766BE user emailMeAtLogin throws TypeError

Stefan Froemken 03/17/21, 13:35 updated 05/11/21, 16:00

Description

Hello,

I have activated emailMeAtLogin in my BE user settings and of cause I have an email address assigned. After log out and log in this TypeError was thrown:

Argument 1 passed to TYPO3\CMS\Core\FormProtection\FormProtectionFactory::getMessageClosure() must be an instance of TYPO3\CMS\Core\Localization\LanguageService, null given, called in /var/www/html/public/typo3/sysext/core/Classes/FormProtection/FormProtectionFactory.php on line 115

Tested on TYPO3 10.4.12 and 10.4.14

I have tried to debug that.

In Middleware\BackendUserAuthenticator we have these lines:

$GLOBALS['BE_USER']->backendCheckLogin($this->isLoggedInBackendUserRequired($pathToRoute));
$GLOBALS['LANG'] = LanguageService::createFromUserPreferences($GLOBALS['BE_USER']);

The upper line will check for first login and tries to send an email. The HTML email is Fluid-based and contains an image titled with “TYPO3 Logo”. The ImageServices calls an Image-Task. The Task calls the DeferredBackendImageProcessor. From there the UriBuilder with method buildUriForRoute will be called, which will generate a form token as access to route is not public. The self::getMessageClosure expected $GLOBALS[‘LANG’] to be of type LanguageService.

But as you see $GLOBALS[‘LANG’] will be initialized after emailMeAtLogin.

Reviews 2