Bug #91305
openWrong mount points cause empty page tree, exceptions (multiple errors in the code)
0%
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
- Have more than one language
- Have a non-admin user
- in the backend group for the user select a translation for the web mount instead of a default language page
- Login with that user and go to the Page module
Updated by Tymoteusz Motylewski over 4 years ago
how can you do step 3
"in the backend group for the user select a translation for the web mount instead of a default language page"
can you add some screenshot?
Updated by Dmitry Dulepov over 4 years ago
how can you do step 3
Click the icon near the mount points field to show the element browser. Go to the page you want to select. You will see its translation on the right side of the element browser. Click one of them. This is what our customer did. He was sure this is a proper way: if records are selectable, than they are allowed for selection.