diff --git a/projects/plugins/jetpack/changelog/fix-division-by-zero-fatal-story-block b/projects/plugins/jetpack/changelog/fix-division-by-zero-fatal-story-block new file mode 100644 index 0000000000000..e08c9a67c2920 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-division-by-zero-fatal-story-block @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Jetpack plugin - Story Block: Fix 'Division by zero' Fatal diff --git a/projects/plugins/jetpack/extensions/blocks/story/story.php b/projects/plugins/jetpack/extensions/blocks/story/story.php index 841a266ea2733..f279d0ee807b3 100644 --- a/projects/plugins/jetpack/extensions/blocks/story/story.php +++ b/projects/plugins/jetpack/extensions/blocks/story/story.php @@ -229,7 +229,12 @@ class="wp-block-jetpack-story_image wp-story-image %3$s" * @return string The CSS class which will display a cropped image */ function get_image_crop_class( $width, $height ) { - $crop_class = ''; + $crop_class = ''; + $width = (int) $width; + $height = (int) $height; + if ( ! $width || ! $height ) { + return $crop_class; + } $media_aspect_ratio = $width / $height; $target_aspect_ratio = EMBED_SIZE[0] / EMBED_SIZE[1]; if ( $media_aspect_ratio >= $target_aspect_ratio ) {