Hello

i have a problem with Varnish Purger, the Purge queue is not filled anymore. In Drupal.log i find the following message

node/4/edit|243||Notice: Undefined offset: 0 in varnish_image_purge_entity_update() (line 98 of /var/XXX/modules/varnish_purge/modules/varnish_image_purge/varnish_image_purge.module)

And one line below

node/4/edit|243||Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple()

It already worked in the past.

I hope you can help me.

With kind regards
Chris

Comments

ChrisBee created an issue. See original summary.

ChrisBee’s picture

Status: Active » Closed (works as designed)
mikelutz’s picture

Status: Closed (works as designed) » Active

Why was this issue closed as works as designed with no comment? This is causing me headaches as well. varnish_image_purge_entity_update() collects all the image fields on an entity, and accesses element 0 without checking to see if the image field is empty or not, throwing a notice in the array index access attempt, and a warning when calling File::load(NULL).

In addition, if I'm reading this correctly, if the image field has a cardinality > 1, only the first image in the field is queued for cache removal, and all the rest are ignored. This should be looping through all the images in the image field, if available and queueing them all (or none if the field is empty)

mikelutz’s picture

This patch checks to make sure the image field is not empty, and purges all images in a field, not just the first one.

  • MiSc committed 9855874 on 8.x-1.x authored by mikelutz
    Issue #2933886 by mikelutz: Undefined offset: 0 in...
misc’s picture

Version: 8.x-1.9 » 8.x-1.x-dev
Status: Active » Fixed

Thanks for the patch @mikelutz, I have added it to the latest dev, and it will be in the new release later today.

Status: Fixed » Closed (fixed)

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