Media: avoid "divide by zero" in wp_get_attachment_image_srcset_array()
.
Fixes #34238. Built from https://develop.svn.wordpress.org/trunk@35081 git-svn-id: http://core.svn.wordpress.org/trunk@35046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8b49acdd0e
commit
affe1ab5ad
@ -921,7 +921,11 @@ function wp_get_attachment_image_srcset_array( $attachment_id, $size = 'medium'
|
|||||||
$candidate_url = path_join( dirname( $img_url ), $img['file'] );
|
$candidate_url = path_join( dirname( $img_url ), $img['file'] );
|
||||||
|
|
||||||
// Calculate the new image ratio.
|
// Calculate the new image ratio.
|
||||||
$img_ratio_compare = $img['height'] / $img['width'];
|
if ( $img['width'] ) {
|
||||||
|
$img_ratio_compare = $img['height'] / $img['width'];
|
||||||
|
} else {
|
||||||
|
$img_ratio_compare = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// If the new ratio differs by less than 0.01, use it.
|
// If the new ratio differs by less than 0.01, use it.
|
||||||
if ( abs( $img_ratio - $img_ratio_compare ) < 0.01 && ! in_array( $candidate_url, $candidates ) ) {
|
if ( abs( $img_ratio - $img_ratio_compare ) < 0.01 && ! in_array( $candidate_url, $candidates ) ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-35080';
|
$wp_version = '4.4-alpha-35081';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user