- Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
[Block] Post TermsAffects the Post Terms BlockAffects the Post Terms Block[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
The gutenberg_render_block_core_post_terms function is supposed to return string and other code is expecting a string. However, the function directly returns the output of the get_the_term_list which may return string|false|WP_Error.
When a WP_Error is returned, there is a fatal error emitted in WordPress core's WP_Block::render where the output is typecasted to string:
Uncaught Error: Object of class WP_Error could not be converted to string IMHO, the code of the gutenberg_render_block_core_post_terms should check the output value of the get_the_term_list and eventually change the output similarly how WordPress core handles the WP_Error situations when dealing with the function.
Step-by-step reproduction instructions
- Have a block rendered by the
gutenberg_render_block_core_post_termson a page. - Make the
get_the_term_listto return an instance ofWP_Error(eg.: by filtering theget_the_terms) - Load the page
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 6.7 alpha, Gutenberg 19.2.0, PHP 8.1
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
Metadata
Metadata
Assignees
Labels
[Block] Post TermsAffects the Post Terms BlockAffects the Post Terms Block[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended