diff --git a/projects/plugins/jetpack/changelog/fix-carousel-array-check b/projects/plugins/jetpack/changelog/fix-carousel-array-check new file mode 100644 index 0000000000000..78f4b2fdc9100 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-carousel-array-check @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Carousel: verify array to avoid PHP warnings diff --git a/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php b/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php index e5a57abe110c9..ae07b7e9f13c7 100644 --- a/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php +++ b/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php @@ -831,6 +831,10 @@ class_exists( 'Jetpack_AMP_Support' ) } $image_elements = $selected_images[ $attachment->ID ]; + if ( ! is_array( $image_elements ) ) { + continue; + } + $attributes = $this->add_data_to_images( array(), $attachment ); $attributes_html = ''; foreach ( $attributes as $k => $v ) {