Do not use t3lib_pageTree
The current version of advanced sitemaps uses
t3lib_pageTree to gather the tree of pages to display in the sitemap. This is conceptually wrong, since the sitemap is designed to be displayed in the FE, whereas
t3lib_pageTree is targeted at the BE (as can be seen, for example, by its member variable
Until recently this was not an issue. But a recent security fix (see https://review.typo3.org/#/c/22632/) introduced a call a method of the BE_USER object inside the
getTree() method called by advanced sitemaps. This will not cause a PHP fatal error, since the BE_USER object does not exist in the FE, unless one is also logged into the BE. The error happens in TYPO3 6.1 and above.
The solution is to avoid using
t3lib_pageTree, which was not meant for this in the first place.
The attached patch makes use of the menu-building methods provided by
t3lib_pageSelect, which is meant for use in the FE. This does not provide a whole page tree like before, so some logic is added to advanced sitemaps.
Note that the attached patch also corrects an issue when no records configuration was included, which led to a SQL syntax error (empty