Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Stop crashing with Lightbox on image blocks without an image.
Resolves WordPress/gutenberg#55217 When rendering images with the lightbox "expand on click" function enabled, if an image block is encountered with no image (for example, a block was added but no image was ever selected), then WordPress would create a warning that an "undefined array key 0" was being accessed because the server code assumes an IMG element exists in the block's HTML. In this patch a check is performed to ensure that an IMG block exists before processing the block. If one isn't, for any reason, the original given HTML for the block is passed through un-modified. This patch needs to be backported into Gutenberg from where it's sourced but this issue arose during the WordPress 6.4 beta testing and needs to be resolved immediately in Core.
- Loading branch information