From c2db3e5bafdcdca738365292d9b19b76ad21226e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 18 Oct 2017 15:08:58 +0000 Subject: [PATCH] Embeds: Avoid "Division by zero" warning in `embed-content.php` template if a thumbnail has a zero height. Props stevenlinx, aegis123. Fixes #40931. git-svn-id: https://develop.svn.wordpress.org/trunk@41902 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/theme-compat/embed-content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/theme-compat/embed-content.php b/src/wp-includes/theme-compat/embed-content.php index c77026bd67..11bef95df8 100644 --- a/src/wp-includes/theme-compat/embed-content.php +++ b/src/wp-includes/theme-compat/embed-content.php @@ -39,7 +39,7 @@ $meta = wp_get_attachment_metadata( $thumbnail_id ); if ( ! empty( $meta['sizes'] ) ) { foreach ( $meta['sizes'] as $size => $data ) { - if ( $data['width'] / $data['height'] > $aspect_ratio ) { + if ( $data['height'] > 0 && $data['width'] / $data['height'] > $aspect_ratio ) { $aspect_ratio = $data['width'] / $data['height']; $measurements = array( $data['width'], $data['height'] ); $image_size = $size;