diff --git a/typo3/sysext/adminpanel/Classes/Modules/PreviewModule.php b/typo3/sysext/adminpanel/Classes/Modules/PreviewModule.php index b430d48b37eb5e639a4b26009dc49b719fbadfc6..d228d71316ae84210c43f3cafc41382bb4834714 100644 --- a/typo3/sysext/adminpanel/Classes/Modules/PreviewModule.php +++ b/typo3/sysext/adminpanel/Classes/Modules/PreviewModule.php @@ -199,7 +199,7 @@ class PreviewModule extends AbstractModule $tsfe->fe_user->usergroup_column => $tsfe->simUserGroup, ]; } - $context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $tsfe->fe_user)); + $context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $tsfe->fe_user ?: null)); } if (!$tsfe->simUserGroup && !$simTime && !$showHiddenPage && !$showHiddenRecords) { $tsfe->fePreview = 0; diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 0bb14d099126da75b560343475f1872603fecf72..2a98a13614d5bb522d8715146c78fca0247e3e25 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -995,7 +995,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface } $this->gr_list = implode(',', $userGroups); - $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user, $userGroups)); + $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?: null, $userGroups)); // For every 60 seconds the is_online timestamp for a logged-in user is updated if ($isUserAndGroupSet) { @@ -1164,7 +1164,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface $userGroups = [0, -2]; } $this->gr_list = implode(',', $userGroups); - $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user, $userGroups)); + $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?: null, $userGroups)); // Fetching the id again, now with the preview settings reset. $this->fetch_the_id(); } @@ -5096,7 +5096,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface /** @var UserAspect $aspect */ $aspect = $this->context->getAspect('frontend.user'); if ($propertyValue) { - $aspect = GeneralUtility::makeInstance(UserAspect::class, $this->fe_user, $aspect->getGroupIds()); + $aspect = GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?: null, $aspect->getGroupIds()); } else { $aspect = GeneralUtility::makeInstance(UserAspect::class, null, $aspect->getGroupIds()); } @@ -5104,7 +5104,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface break; case 'gr_list': trigger_error('Property $TSFE->gr_list is not in use anymore as this information is now stored within the frontend.user aspect.'); - $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user, GeneralUtility::intExplode(',', $propertyValue))); + $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?: null, GeneralUtility::intExplode(',', $propertyValue))); break; case 'beUserLogin': trigger_error('Property $TSFE->beUserLogin is not in use anymore as this information is now stored within the backend.user aspect.'); @@ -5168,7 +5168,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface break; case 'gr_list': trigger_error('Property $TSFE->gr_list is not in use anymore as this information is now stored within the frontend.user aspect.'); - $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user, [])); + $this->context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?: null, [])); break; case 'beUserLogin': trigger_error('Property $TSFE->beUserLogin is not in use anymore as this information is now stored within the backend.user aspect.');