Issue Bug New Orphaned

#108995Anonymous Fe Session on Redis vs. DB

Pascal Hofmair 02/17/26, 09:51 updated 02/26/26, 14:38

Description

anonymous fe sessions are handeled differently on redis vs. db backend. the following snippet works fine on \TYPO3\CMS\Core\Session\Backend\DatabaseSessionBackend::class (default), but failes if \TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::class in $GLOBALS[‘TYPO3_CONF_VARS’][‘SYS’][‘session’][‘FE’][‘backend’] is used:

$userSessionManager = \TYPO3\CMS\Core\Session\UserSessionManager::create('FE');
$session = $userSessionManager->createFromRequestOrAnonymous(
    $GLOBALS['TYPO3_REQUEST'],
    'mysession',
);
$session->set('mykey', serialize(123));
$userSessionManager->updateSession($session);

this is because redis backend throws an error if no session is found (https://github.com/TYPO3/typo3/blob/13.4/typo3/sysext/core/Classes/Session/Backend/RedisSessionBackend.php#L190)
but db backend is okay with missing sessions (https://github.com/TYPO3/typo3/blob/13.4/typo3/sysext/core/Classes/Session/Backend/DatabaseSessionBackend.php#L169).

Reviews 0

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

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Anonymous Fe Session on Redis vs. DB Resolves: #108995 Releases: main