When indexing, in the event that an entity contains a field but that field does not contain a value it still proceeds and tries to foreach through that array (which wouldn't be an array) and therefore you receive the following error:

Invalid argument supplied for foreach() callback_attachments_references_settings.inc:38

My proposed solution would be to check if the referenced entities is empty, and continue with the next field if it is.

// Manage case of field having no value and continue with next field.
if (empty($referenced_entities)) {
  continue;
}

Comments

andywhale created an issue. See original summary.

andy_w’s picture

Assigned: andy_w » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.06 KB

Patch attached to check for results.

izus’s picture

ok
thanks for this

  • izus committed c7f5dac on 7.x-1.x authored by andywhale
    Issue #2998963 by andywhale, izus: Empty file reference field causes a...
izus’s picture

Status: Needs review » Fixed

it's merged :)

Status: Fixed » Closed (fixed)

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