Project

General

Profile

Actions

Bug #79013

closed

Using PageTreeView without logged in BE_USER throws error

Added by Philipp Parzer almost 8 years ago. Updated almost 8 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-12-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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?


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #78211: AbstractTreeView: Call to a member function isInWebMount() throwed FATALRejected2016-10-09

Actions
Actions #1

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.

Actions

Also available in: Atom PDF