We recently encountered this kind of notice. Seems like it's happening when media slideshow is used as entity reference via inline_entity_form. In our case have a "gallery" paragraph which has entity reference field to "slideshow" media bundle. On a node edit form we inline that paragraph. If we add gallery paragraph and then remove it right after, save the node, then this notice is encountered.

The problem happens on the line \Drupal\media_entity_slideshow\Plugin\MediaEntity\Type\slideshow_item:99

/** @var \Drupal\media_entity\MediaInterface $slideshow_item */
$slideshow_item = $this->entityTypeManager->getStorage('media')->load($media->{$source_field}->target_id);
if (!$slideshow_item) {
  return $this->getDefaultThumbnail();
}

Because the source field contains value [0 => NULL] and that notice pops up.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hideaway created an issue. See original summary.

hideaway’s picture

Not sure if it's problem of media_entity_slideshow module, can be also on inline_entity_form side. Anyway, the following extra condition (which I hope does not do any harm) is fixing it for us.

mbm80’s picture

Rerolled for 2.x

chr.fritsch’s picture

This is a problem of IEF I think because with the patch the deleted gallery will still be created.

chr.fritsch’s picture

Status: Active » Reviewed & tested by the community

I am going to commit this fix. It makes the world a bit better. We are also facing this issue when you try to save a media entity (slideshow) without any images (for example programmatically).

  • chr.fritsch committed b3acd58 on 8.x-2.x authored by mbm80
    Issue #3004389 by hideaway, mbm80: array_flip(): Can only flip STRING...
chr.fritsch’s picture

Status: Reviewed & tested by the community » Fixed

Thank you

Status: Fixed » Closed (fixed)

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