Opened 3 years ago
Closed 3 years ago
#55165 closed defect (bug) (reported-upstream)
Site Logo Block causing division by zero notice when image dimensions are not available
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.9 |
Component: | Editor | Keywords: | |
Focuses: | Cc: |
Description
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 ) ) {
with
if ( empty( $attributes['width'] ) || empty( $image ) || ! $image[1] || ! $image[2] ) {
Attachments (2)
Change History (8)
#2
@
3 years ago
- Milestone changed from Awaiting Review to 5.9.1
- Owner set to audrasjb
- Severity changed from minor to normal
- Status changed from new to accepted
Thanks for the report @maximus80!
This need to be reported upstream on Gutenberg GitHub repository. I opened an issue and added a PR for this change:
- issue: https://github.com/WordPress/gutenberg/issues/38807
- pull request: https://github.com/WordPress/gutenberg/pull/38808
Let's keep this ticket open for now to make sure it's addressed.
#4
@
3 years ago
- Keywords has-patch removed
- Milestone changed from 5.9.1 to 5.9.2
5.9.1. is happening in a few hours. Since the issue is still open and unresolved, moving this ticket to 5.9.2.
Also resetting keywords as fix will happen in Gutenberg and then be backported to Core.
Patched site-logo.php