Issue Bug Closed

#94187Session not updated within same page

Aimeos no-lastname-given 05/21/21, 14:22 updated 07/27/24, 14:29

Description

Precondition: Two frontend plugins are placed on the same page

1.) In the user session, “key” has been set to “test” in a different request before
2.) Plugin 1 updates a key in the user session using \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::setAndSaveSessionData(‘key’, ‘test2’)
3.) Plugin 2 on the same page reads the key using \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::getSessionData(‘key’)

The value returned in plugin 2 is “test”, not “test2”.
In TYPO3 9.5, the correct value (“test2) has been returned.

Reviews 0

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

History 1

  1. Georg Ringer commented and changed status New Closed 07/27/24, 14:29

    Hey Norbert,

    just tested that in v13 with simple example

            $contentObjectData = $this->request->getAttribute('currentContentObject');
            $el  = $contentObjectData->data;
            $uid = $el['uid'];
    
            $user = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.user');
            $newCache = 'dataValue' . time();
            if ($uid === 5) {
                $user->setAndSaveSessionData('dataKey', $newCache);
            }
    
            DebuggerUtility::var_dump($user->getSessionData('dataKey'), 'el' . $uid);

    and it worked out fine. Important is that the 2nd plugin is really rendered after the 1st one, so e.g. because it is positioned in same colpos but after the 1st one.

    if you don’t agree, feel free to contact me via slack!