Issue Bug Rejected

#79013Using PageTreeView without logged in BE_USER throws error

Philipp Parzer 12/16/16, 11:57 updated 12/20/16, 13:00

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?

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.