Item::getFields() has this code right now:

          try {
            Utility::extractFields($this->getOriginalObject(), $fields_by_property_path);
          }
          catch (SearchApiException $e) {
            // If we couldn't load the object, just log an error and fail
            // silently to set the values.
            watchdog_exception('search_api', $e);
          }

But that exception is not thrown, instead, it gives a recoverable fatal error because we pass in NULL to that method.

When that is fixed, in views, there is a similar issue because $row->_item isn't properly loaded. Added an additional safeguard on that too.

CommentFileSizeAuthor
#1 avoid-fatals-2353495-1.patch1.65 KBBerdir
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Status: Active » Needs review
FileSize
1.65 KB
drunken monkey’s picture

Status: Needs review » Fixed

Thanks for opening this, I guess this really makes a lot of sense. At least we currently don't check this return value for NULL anywhere.
However, when changing this code, we of course also have to change the associated interface documentation to add the necessary @throws tag.
I fixed that, and also added a try/catch in the Highlight processor. In all other processors, the method is only called in preprocessIndexItems(), where an original object should always be set. Otherwise, we have an exception there instead of a fatal error, which is also an improvement.

So, committed with these two changes. Thanks again!

  • drunken monkey committed 0463cc3 on 2349435-seperate-processors-by-stage authored by Berdir
    Issue #2353495 by Berdir, drunken monkey: Fixed fatal errors when...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.