Issue Bug Closed

#92489Calling $contentObjectRenderer->getTreeList() in eID returns empty list

Xavier Perseguers 10/06/20, 11:00 updated 12/22/20, 11:04

Description

During Application’s bootstrap, \TYPO3\CMS\Frontend\Http\Application::initializeContext() does that:

        GeneralUtility::makeInstance(Context::class, [
            'date' => new DateTimeAspect(new \DateTimeImmutable('@' . $GLOBALS['EXEC_TIME'])),
            'visibility' => new VisibilityAspect(),
            'workspace' => new WorkspaceAspect(0),
            'backend.user' => new UserAspect(null),
            'frontend.user' => new UserAspect(null, [0, -1]),
        ]);

this creates a default frontend.user aspect without any AbstractAuthenticationUser. As we see in the UserAspect constructor, this is totally legit and creates a stdClass object in such case:

    /**
     * @param AbstractUserAuthentication|null $user
     * @param array|null $alternativeGroups
     */
    public function __construct(AbstractUserAuthentication $user = null, array $alternativeGroups = null)
    {
        $this->user = $user ?? (object)['user' => []];
        $this->groups = $alternativeGroups;
    }

Problem is that the method ->getGroupUids() wrongly check for either a BackendUserAuthentication or a FrontendUserAuthentication for returning the associated groups, which can never occur in that context.

Due to this erroneous condition, the tree list is always empty!

Reviews 2