Issue Bug New Orphaned Good first issue

#91305Wrong mount points cause empty page tree, exceptions (multiple errors in the code)

Dmitry Dulepov 05/05/20, 11:37 updated 03/23/25, 22:32

Description

Before TYPO3 9.5 pages table only contained records for the default language. Since TYPO3 9.5 they also contain records in other languages. Unfortunately be_groups TCA definition was not updated to allow only records in the default language. This causes the following problem: if the user mistakenly adds a db mount for the page in non-default language, this page becomes inaccessible to the non-admin user and the whole page tree is not displayed with the exception.

Same problem is for be_users table with db mounts.

The exception itself is cryptic:

Core: Exception handler (WEB): Uncaught TYPO3 Exception:
 trim() expects parameter 1 to be string, null given | TypeError thrown in file
/home/prod/web/typo3/sysext/backend/Classes/Controller/Page/TreeController.php in line 267

This happens inside the function named pagesToFlatArray because it gets an empty array in $page parameter. The cause of this problem is inside getAllEntryPointPageTrees which has the following check:

            $entryPoint = $repository->getTree($entryPoint, function ($page) use ($backendUser) {
                // check each page if the user has permission to access it
                return $backendUser->doesUserHaveAccess($page, Permission::PAGE_SHOW);
            });
            if (!is_array($entryPoint)) {
                unset($entryPoints[$k]);
            }

The problem here that it will be always an array but it can be empty array. So the check should not be is_array($entry) but empty($entry). When changed to empty($entry) page tree is displayed. However the problem with be_groups TCA should still be fixed!

I see another possible problem in function named fetchDataAction, code:

        if (!empty($request->getQueryParams()['pid'])) {
            $entryPoints = [(int)$request->getQueryParams()['pid']];
        } else {
            $entryPoints = $this->getAllEntryPointPageTrees();
        }

If the condition is true, $entryPoints will not be in the correct format for pagesToFlatArray, which expects a full page record. This will also cause exceptions.

To reproduce the issue

  1. Have more than one language
  2. Have a non-admin user
  3. in the backend group for the user select a translation for the web mount instead of a default language page
  4. Login with that user and go to the Page module

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] Wrong mount points cause empty page tree, exceptions (multiple errors in the code) Resolves: #91305 Releases: main