createItemRenderArray() assumes that search API result items wrap entities and crashes if they don't

Created on 13 March 2024, 7 months ago

Problem/Motivation

createItemRenderArray() does this:

      $originalObject = $item->getOriginalObject();
      if ($originalObject === NULL) {
        return [];
      }
      /** @var \Drupal\Core\Entity\EntityInterface $entity */
      $entity = $originalObject->getValue();

But there is no guarantee that TypedDataInterface::getValue() returns an entity.

This causes a search API page on an index that indexes items from https://www.drupal.org/project/date_occur to crash.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024