ext-solr icon indicating copy to clipboard operation
ext-solr copied to clipboard

[BUG] SiteRepository::getSiteByRootPageId() will raise PHP error when site config is broken [WITH FIX]

Open masi opened this issue 1 year ago • 1 comments
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;
                }

masi avatar Apr 22 '24 18:04 masi

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?

spoonerWeb avatar May 16 '24 15:05 spoonerWeb