SITEROOT marker is replaced with 0 when used in flexform
The problem is that the TcaSelectItems has no dependency to the DatabasePageRootline in case of 'flexFormSegment'.
So the ###SITEROOT### marker is always 0 (AbstractItemProvider->processForeignTableClause) because the used $result[‘rootline’] array is always empty.
I provide a demo Extension to reproduce the bug.
The usecase is to show the editor all product records of the current site.
Product records are stored on the product detail page.