Skip to content

Commit f2cafde

Browse files
magicsundaydkd-kaehm
authored andcommitted
[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
1 parent f8083a6 commit f2cafde

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Classes/ContentObject/Relation.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,15 @@ protected function resolveRelatedValue(
321321
string $foreignTableName = '',
322322
): array {
323323
if ($this->getLanguageUid($parentContentObject) > 0 && !empty($foreignTableName)) {
324-
$relatedRecord = $this->getFrontendOverlayService($parentContentObject)->getOverlay($foreignTableName, $relatedRecord);
324+
$overlayRelatedRecord = $this->getFrontendOverlayService($parentContentObject)->getOverlay($foreignTableName, $relatedRecord);
325+
}
326+
327+
// sys_page->getLanguageOverlay() may return NULL if overlays were activated but no overlay
328+
// was found and LanguageAspect was NOT set to MIXED
329+
//
330+
// If so rely on original record data
331+
if (is_array($overlayRelatedRecord)) {
332+
$relatedRecord = $overlayRelatedRecord;
325333
}
326334

327335
$contentObject = clone $parentContentObject;

0 commit comments

Comments
 (0)