WordPress.org

Make WordPress Core

Changeset 35081


Ignore:
Timestamp:
10/12/2015 08:59:12 PM (5 years ago)
Author:
wonderboymusic
Message:

Media: avoid "divide by zero" in wp_get_attachment_image_srcset_array().

Fixes #34238.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r35078 r35081  
    922922
    923923        // Calculate the new image ratio.
    924         $img_ratio_compare = $img['height'] / $img['width'];
     924        if ( $img['width'] ) {
     925            $img_ratio_compare = $img['height'] / $img['width'];
     926        } else {
     927            $img_ratio_compare = 0;
     928        }
    925929
    926930        // If the new ratio differs by less than 0.01, use it.
Note: See TracChangeset for help on using the changeset viewer.