Opened 4 years ago
Closed 4 years ago
#55165 closed defect (bug) (reported-upstream)
Site Logo Block causing division by zero notice when image dimensions are not available
| Reported by: | maximus80 | Owned by: | audrasjb |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Editor | Version: | 5.9 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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
@
4 years ago
- Milestone Awaiting Review → 5.9.1
- Owner set to
- Severity minor → normal
- Status new → 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
@
4 years ago
- Keywords has-patch removed
- Milestone 5.9.1 → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Patched site-logo.php