Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#59597 closed defect (bug) (fixed)

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

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

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.


3 years 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
3 years ago

  • Milestone Awaiting Review → 6.4

#3 @hellofromTonya
3 years ago

  • Description modified (diff)

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

​@hellofromTonya commented on ​PR #5461:


3 years 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:


3 years 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:


3 years 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.


3 years ago

#8 @oglekler
3 years 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
3 years ago

  • Resolution → fixed
  • Status new → closed

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

Note: See TracTickets for help on using tickets.