From ff4ba58c037738b015ff430ec2b2caa091c44a51 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Fri, 5 Nov 2021 16:57:24 +1300 Subject: [PATCH] Add guards for undefined indexes --- packages/block-library/src/gallery/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/gallery/index.php b/packages/block-library/src/gallery/index.php index 1e5b21e067c66d..74ac0e3b96946a 100644 --- a/packages/block-library/src/gallery/index.php +++ b/packages/block-library/src/gallery/index.php @@ -21,7 +21,7 @@ function render_block_core_gallery_data( $parsed_block ) { if ( 'core/gallery' === $parsed_block['blockName'] ) { foreach ( $parsed_block['innerBlocks'] as $key => $inner_block ) { if ( 'core/image' === $inner_block['blockName'] ) { - if ( ! $parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] ) { + if ( ! isset( $parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] ) && isset( $inner_block['attrs']['id'] ) ) { $parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] = esc_attr( $inner_block['attrs']['id'] ); } }