If a referenced media item goes missing for any reason, a PHP fatal error is encountered when rendering the page.
This happens in \Drupal\entity_browser_block\Plugin\Block\EntityBrowserBlock::build when looping over $entities.
An easy fix will be to check for emptiness first thing in that loop. A very helpful addition would be to prevent the deleting of referenced entities.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3006352-broken-references-cause-fatal-errors-2.patch | 685 bytes | nadavoid |
Comments
Comment #2
nadavoid commentedThis patch checks at the beginning of the loop whether the entity is empty. If it is, it
continues, skipping that iteration of the loop.Comment #3
nadavoid commentedComment #4
karens commentedI ran into this problem as well and the patch fixes it.
Without the patch, if a referenced item is deleted, the page won't build and fails with a fatal error. With the patch it builds and just doesn't display the broken item.
Comment #5
chris matthews commentedComment #7
samuel.mortensonThanks all!