-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Image block uses esc_attr() wrongly, passing an array #54930
Copy link
Copy link
Closed as not planned
Labels
[Block] ImageAffects the Image BlockAffects the Image Block[Feature] Interactivity APIAPI to add frontend interactivity to blocks.API to add frontend interactivity to blocks.[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
Introduced in #3851 / badc344, this causes PHP warnings when using the Image block with Lightbox enabled.
Why?
The block_core_image_render_lightbox() function passes the results of wp_get_global_styles() directly to esc_attr().
wp_get_global_styles() can return an array, but esc_attr() works on strings.
Step-by-step reproduction instructions
- Insert image block with lightbox (I was using the 2021 theme)
- See warning
Screenshots, screen recording, code snippet
No response
Environment info
WP trunk
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Block] ImageAffects the Image BlockAffects the Image Block[Feature] Interactivity APIAPI to add frontend interactivity to blocks.API to add frontend interactivity to blocks.[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Type
Fields
Give feedbackNo fields configured for issues without a type.