Bug #79013
closedUsing PageTreeView without logged in BE_USER throws error
0%
Description
In the TYPO3\CMS\Backend\Tree\View\AbstractTreeView on line 765 is an if statement which checks if the page isInWebMount of the logged in Backend User but there is no check if there is a backend user object at all. I am using the PageTreeView to get all pages in a UserFunc and generate a "Random Menu" where always 5 random pages are returned to the TMENU. When i am not logged in to the backend it throws an Error: "Fatal error: Call to a member function isInWebMount() on null in /websites/typo3/instance/vendor/typo3/cms/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php on line 765" so i changed:
if (!$this->getBackendUser()->isInWebMount($pageUid)) { // Current record is not within web mount => skip it continue; }
to
if (!empty($this->getBackendUser()) && !$this->getBackendUser()->isInWebMount($pageUid)) { // Current record is not within web mount => skip it continue; }
To check if there is a backend user before calling the isInWebMount().
Is there anything i missed?
Updated by Wouter Wolters almost 8 years ago
- Status changed from New to Rejected
The pagetree is not meant for frontend usage. The BE_USER does not exist there. This example only works in backend context of TYPO3.
There is no API in TYPO3 for the pagetree in the frontend.
I have to reject this bug report because the code can't work in the frontend.