From ac5096d8bdccb454ad74069082f95666d9127060 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 18 Oct 2017 15:09:48 +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. Built from https://develop.svn.wordpress.org/trunk@41902 git-svn-id: http://core.svn.wordpress.org/trunk@41736 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/theme-compat/embed-content.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/theme-compat/embed-content.php b/wp-includes/theme-compat/embed-content.php index c77026bd67..11bef95df8 100644 --- a/wp-includes/theme-compat/embed-content.php +++ b/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; diff --git a/wp-includes/version.php b/wp-includes/version.php index c7af8e2993..1c8bcd6f91 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-beta2-41901'; +$wp_version = '4.9-beta2-41902'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.