Skip to content

Commit

Permalink
[BUGFIX] Prevent error when overlay is not available
Browse files Browse the repository at this point in the history
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
  • Loading branch information
magicsunday authored and dkd-kaehm committed Dec 19, 2024
1 parent fe71a4f commit 39c6e8a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Classes/ContentObject/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 39c6e8a

Please sign in to comment.