From c71c8ec7a8e39f357a311cf263fa7eb9a22df9c1 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Mon, 16 Oct 2023 15:37:06 +0200 Subject: [PATCH] Fix PHP notice when an image with lightbox is deleted in the behaviors file. --- lib/block-supports/behaviors.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/block-supports/behaviors.php b/lib/block-supports/behaviors.php index c1b3dceceee94d..383f4b4e6f9279 100644 --- a/lib/block-supports/behaviors.php +++ b/lib/block-supports/behaviors.php @@ -109,8 +109,8 @@ function gutenberg_render_behaviors_support_lightbox( $block_content, $block ) { if ( isset( $block['attrs']['id'] ) ) { $img_uploaded_src = wp_get_attachment_url( $block['attrs']['id'] ); $img_metadata = wp_get_attachment_metadata( $block['attrs']['id'] ); - $img_width = $img_metadata['width']; - $img_height = $img_metadata['height']; + $img_width = $img_metadata['width'] ?? 'none'; + $img_height = $img_metadata['height'] ?? 'none'; } else { $img_uploaded_src = $processor->get_attribute( 'src' ); $img_width = 'none';