Site Logo Block causing division by zero notice when image dimensions are not available #38807
Labels
[Block] Site Logo
Affects the Site Logo Block
[Type] Bug
An existing feature does not function as intended
Description
Please note that this is a report coming from Trac, and that
maximus80
deserves the props here.Copy-paste from Trac:
Notice is
Warning: Division by zero in wp-includes/blocks/site-logo.php on line 21
This will happen when the dimensions of the image used inside the site logo block can't be retrieved for some reason.
Example: SVG image being used. That will lead to the divisors being zero here: https://core.trac.wordpress.org/browser/branches/5.9/src/wp-includes/blocks/site-logo.php#L20
Easiest way to fix would be to replace line 17:
if ( empty( $attributes['width'] ) || empty( $image ) ) {
withif ( empty( $attributes['width'] ) || empty( $image ) || ! $image[1] || ! $image[2] ) {
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: