Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image block uses esc_attr() wrongly, passing an array #54930

Closed
swissspidy opened this issue Sep 29, 2023 · 3 comments
Closed

Image block uses esc_attr() wrongly, passing an array #54930

swissspidy opened this issue Sep 29, 2023 · 3 comments
Labels
[Block] Image Affects the Image Block [Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Bug An existing feature does not function as intended

Comments

@swissspidy
Copy link
Member

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

  1. Insert image block with lightbox (I was using the 2021 theme)
  2. 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

@swissspidy swissspidy added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block labels Sep 29, 2023
@swissspidy
Copy link
Member Author

FYI @artemiomorales @michalczaplinski since you worked on that PR.

This should be fixed for the next 6.4 Beta

@SantosGuillamot
Copy link
Contributor

Thanks for reporting this. I believe it is the same problem reported here, which is being handled in this pull request.

@swissspidy
Copy link
Member Author

Indeed. Thanks.

@swissspidy swissspidy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Bug An existing feature does not function as intended
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants