When there are no File types or Media types that have metadata fields to be processed, there will sometimes be errors like Warning: Invalid argument supplied for foreach() in Drupal\exif\ExifContent->get_bundle_for_exif_data() in the error log.

This is caused because $form_state->getValue() returns an empty string when there is not an actual field, but we are expecting an empty array.

CommentFileSizeAuthor
#2 exif-d8-invalid-argument-2959312-2.patch1.11 KBhosef

Comments

hosef created an issue. See original summary.

hosef’s picture

Status: Active » Needs review
StatusFileSize
new1.11 KB

Here is a patch that fixes the issue by checking if an empty value was returned for the entity types and sets them to an empty array.

glenshewchuck’s picture

Good catch. If you have already configured EXIF you need to go back and re-submit the exif configuration form page (/admin/config/media/exif) because this patch updates the configuration on form submit.

gkaas’s picture

I can confirm that this patch works if you re-submit the exif config after applying the patch.

  • hosef authored 02f1f2c on 8.x-1.x
    Issue #2959312 by hosef: Warning: Invalid argument supplied for foreach...
jphautin’s picture

Assigned: Unassigned » jphautin
Status: Needs review » Fixed

applied on 8.x-1.x branch

  • hosef authored 02f1f2c on 8.x-2.x
    Issue #2959312 by hosef: Warning: Invalid argument supplied for foreach...

Status: Fixed » Closed (fixed)

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

zanematthew’s picture

The issue still persists in the latest 1.2 version.

When will this patch be applied to the latest release?

opdavies’s picture

I've created a new issue, #3169084: Plan for EXIF 8.x-1.3, requesting a new 8.x-1.x release.