This issue is the Media Gallery counterpart of #1426820: Fix Notices and EntityMalformedException if FID is not in the file_managed database table.

Similar to that issue, regardless of whether the root cause of the bug is in Media Gallery or not, it might make sense for Media Gallery to work around it because otherwise having files in a gallery that no longer exist as managed files in the database results in fatal errors on your site.

The attached patch implements this workaround.

Comments

moloc’s picture

Just for documentation:
If i see it correct, this issue/patch seems to conflict with the patch in issue #1300144: Missing file object, when rendering referenced gallery as Media gallery block.

moloc’s picture

Your patch works for me, with one side-effect:
Example:
Having a pager with 3 images on one page. You delete one entry in the {file_managed} table. The gallery which shows that image, displays only 2 images on that specific pager-site (because the non-existing image is filtered by this patch). I assume, this can not be changed?

Reproduceable?
Is it enough to just delete one entry in the {file_managed} table? If so, the patch in media does not work for me (i still get a undefined index notice). Or which module does not handle this correct / how is that reproduceable?

moloc’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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