Skip to content

BUG: $GLOBALS['TSFE']->fe_user access in PageService, leads to Exception in v:menu in Typo3 v13 #1969

@NormenKD

Description

@NormenKD

I have checked that the bug exists in the dev-development branch
Yes

I have checked that there are no already open issues or recently closed issues about this bug
Yes

Describe the bug
Using access restricted pages in Typo3 v13 results in an exception with v:menu:

(1/1) TypeError
array_intersect(): Argument #1 ($array) must be of type array, null given

Probably because $GLOBALS['TSFE']->fe_user has been removed in v13 (https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/AppendixA/Index.html#appendix-include-tsfe-feuser-migration):

$userIsLoggedIn = (is_array($GLOBALS['TSFE']->fe_user->user));
$userGroups = $GLOBALS['TSFE']->fe_user->groupData['uid'];
$userIsInGrantedGroups = (0 < count(array_intersect($userGroups, $groups)));

To Reproduce
Use v:menu in a template, use access restricted pages in page tree, maybe also set showAccessProtected="1" on a v13 system.

Expected behavior
No exception should be thrown.

Screenshots

Image

Additional context
Another access to $GLOBALS['TSFE']->fe_user, which might be problematic in v13 (not sure):

https://github.com/FluidTYPO3/vhs/blob/development/Classes/ViewHelpers/Security/AbstractSecurityViewHelper.php#L358-L361

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions