Issue Bug New Orphaned

#106101allow a null value for the getSession method

Franz Holzinger 02/06/25, 16:06 updated 03/07/25, 12:08

Description

Under some circumstances the session member variable of FrontendUserAuthentication is null.

abstract class AbstractUserAuthentication implements LoggerAwareInterface
{
…
protected ?UserSession $userSession = null;
…
public function getSession(): UserSession {
return $this->userSession;
}
}

The method getSession should return the null value if userSession is null and not cause a PHP TypeError.

TypeError TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::getSession(): Return value must be of type TYPO3\CMS\Core\Session\UserSession, null returned

Solution:

public function getSession(): ?UserSession

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] allow a null value for the getSession method Resolves: #106101 Releases: main