ext-solr
ext-solr copied to clipboard
[BUG] SiteRepository::getSiteByRootPageId() will raise PHP error when site config is broken [WITH FIX]
trafficstars
Describe the bug If the site config is broken for a site then buildSite() will return a null value. This is in turn return by buildTypo3ManagedSite() when the SiteFinder throws an exception.
To Reproduce Add a site config with a root page that has a parent page that does not exist.
Expected behavior No PHP error. Ideally a log entry.
Solution Add a check:
$typo3ManagedSolrSite = $this->buildSite($rootPageId);
if ($typo3ManagedSolrSite && $typo3ManagedSolrSite->isEnabled()) {
$typo3ManagedSolrSites[$rootPageId] = $typo3ManagedSolrSite;
}
Add a site config with a root page that has a parent page that does not exist.
@masi What do you mean with that? Can you give a more concrete example?