From 39c6e8ae6fc53ddc1298550140a1214dae12178b Mon Sep 17 00:00:00 2001 From: Rico Sonntag Date: Thu, 5 Dec 2024 14:16:33 +0100 Subject: [PATCH] [BUGFIX] Prevent error when overlay is not available This fixes: Core: Error handler (BE): PHP Warning: Trying to access array offset on value of type null in /var/www/vendor/apache-solr-for-typo3/solr/Classes/ContentObject/Relation.php line 311 --- Classes/ContentObject/Relation.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Classes/ContentObject/Relation.php b/Classes/ContentObject/Relation.php index cde91d009..089afb26c 100644 --- a/Classes/ContentObject/Relation.php +++ b/Classes/ContentObject/Relation.php @@ -306,8 +306,18 @@ protected function resolveRelatedValue( ContentObjectRenderer $parentContentObject, string $foreignTableName = '', ): array { + $overlayRelatedRecord = null; + if ($this->getLanguageUid() > 0 && !empty($foreignTableName)) { - $relatedRecord = $this->getFrontendOverlayService()->getOverlay($foreignTableName, $relatedRecord); + $overlayRelatedRecord = $this->getFrontendOverlayService()->getOverlay($foreignTableName, $relatedRecord); + } + + // sys_page->getLanguageOverlay() may return NULL if overlays were activated but no overlay + // was found and LanguageAspect was NOT set to MIXED + // + // If so rely on original record data + if (is_array($overlayRelatedRecord)) { + $relatedRecord = $overlayRelatedRecord; } $contentObject = clone $parentContentObject;