Make WordPress Core

#59597 closed defect (bug) (fixed)

Fix: Stop crashing with Lightbox on image blocks without an image.

Reported by: dmsnell's profile dmsnell Owned by:
Milestone: 6.4 Priority: normal
Severity: normal Version: 6.4
Component: Editor Keywords: has-patch gutenberg-merge
Focuses: Cc:

Description (last modified by hellofromTonya)

Resolves https://github.com/WordPress/gutenberg/pull/55217

When rendering images with the lightbox "expand on click" function enabled, if an image block is encountered with no image (for example, a block was added but no image was ever selected), then WordPress would create a warning that an "undefined array key 0" was being accessed because the server code assumes an IMG element exists in the block's HTML.

In this patch a check is performed to ensure that an IMG block exists before processing the block. If one isn't, for any reason, the original given HTML for the block is passed through un-modified.

This patch needs to be backported into Gutenberg from where it's sourced but this issue arose during the WordPress 6.4 beta testing and needs to be resolved immediately in Core.

Change History (9)

This ticket was mentioned in PR #5461 on WordPress/wordpress-develop by @dmsnell.


10 months ago
#1

Trac ticket: Core-59597

Resolves WordPress/Gutenberg#55217

When rendering images with the lightbox "expand on click" function enabled, if an image block is encountered with no image (for example, a block was added but no image was ever selected), then WordPress would create a warning that an "undefined array key 0" was being accessed because the server code assumes an IMG element exists in the block's HTML.

In this patch a check is performed to ensure that an IMG block exists before processing the block. If one isn't, for any reason, the original given HTML for the block is passed through un-modified.

This patch needs to be backported into Gutenberg from where it's sourced but this issue arose during the WordPress 6.4 beta testing and needs to be resolved immediately in Core.

#2 @swissspidy
10 months ago

  • Milestone changed from Awaiting Review to 6.4

#3 @hellofromTonya
10 months ago

  • Description modified (diff)

Modifying to provide a link back to Gutenberg, as the previous linked to Trac.

@hellofromTonya commented on PR #5461:


10 months ago
#4

Hey @dmsnell, is https://github.com/WordPress/gutenberg/pull/55217 the correct link back to the issue in Gutenberg? They seem unrelated.

@dmsnell commented on PR #5461:


10 months ago
#5

thank you @hellofromtonya - correct, that was a mistake. I've updated the description to point to the right issue now, which is 55214 and not 55217

@dmsnell commented on PR #5461:


10 months ago
#6

Closing since this has been incorporated into Gutenberg and will come over in the next package update.

This ticket was mentioned in Slack in #core by oglekler. View the logs.


10 months ago

#8 @oglekler
10 months ago

  • Keywords gutenberg-merge added

This looks like it should be addressed on the Gutenberg side, so, I am marking this as gutenberg-merge.

#9 @hellofromTonya
10 months ago

  • Resolution set to fixed
  • Status changed from new to closed

Closing as fixed, as [56849] also resolved this issue.

Note: See TracTickets for help on using tickets.