Project

General

Profile

Actions

Bug #91305

open

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

Added by Dmitry Dulepov almost 4 years ago. Updated almost 4 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Pagetree
Target version:
-
Start date:
2020-05-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

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
Actions

Also available in: Atom PDF