[wp-trac] [WordPress Trac] #60928: Interactivity API: Fatal error with empty image
WordPress Trac
noreply at wordpress.org
Fri Apr 26 16:10:06 UTC 2024
#60928: Interactivity API: Fatal error with empty image
-------------------------------+---------------------
Reporter: donohoe | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.5.3
Component: Editor | Version: 6.5
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+---------------------
Comment (by grantmkin):
@rasshivkina Thanks for following up with details, and I'm glad you found
a fix for your issue!
I'm not sure what filter you were using on the image block. If it was
`render_block_core/image`, and the callback was returning `null` for block
content, I think it's expected that could cause issues.
The `$block_content` value returned by the filter is expected to be a
string (see the filter documentation here:
https://developer.wordpress.org/reference/hooks/render_block_this-name/)
From the error shared in the ticket description, the type hinting added to
the static closure within
`wp_interactivity_process_directives_of_interactive_blocks` seems to be
what's triggering the error, and this code is new since WP 6.5. But since
the `render_block_{$this->name}` filter is expected to return a string, I
don't think there's anything to fix within the WordPress code. Block
render output is generally always expected to be a string.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60928#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list