Make WordPress Core

Ticket #40931: 40931.diff

File 40931.diff, 738 bytes (added by stevenlinx, 7 years ago)

fix division by zero in embed-content.php

  • src/wp-includes/theme-compat/embed-content.php

    diff --git a/src/wp-includes/theme-compat/embed-content.php b/src/wp-includes/theme-compat/embed-content.php
    index f706c68..b0db9b1 100644
    a b  
    3030                        $meta = wp_get_attachment_metadata( $thumbnail_id );
    3131                        if ( ! empty( $meta['sizes'] ) ) {
    3232                                foreach ( $meta['sizes'] as $size => $data ) {
    33                                         if ( $data['width'] / $data['height'] > $aspect_ratio ) {
     33                                        if ( ($data['width'] > 0 && $data['height'] > 0) && $data['width'] / $data['height'] > $aspect_ratio ) {
    3434                                                $aspect_ratio = $data['width'] / $data['height'];
    3535                                                $measurements = array( $data['width'], $data['height'] );
    3636                                                $image_size   = $size;