[wp-trac] [WordPress Trac] #53757: Widget editor calls get_block_categories() with incorrect arg type

WordPress Trac noreply at wordpress.org
Fri Jul 23 05:11:57 UTC 2021


#53757: Widget editor calls get_block_categories() with incorrect arg type
--------------------------+-----------------------------
 Reporter:  Enchiridion   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  5.8
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Just updated to 5.8.0 and found a couple issues with the new block widget
 editor while fixing all the new deprecated filters related to blocks.

 \wp-admin\widgets-form-blocks.php:55
 `sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode(
 get_block_categories( 'widgets-editor' ) ) ),`

 \wp-includes\class-wp-customize-widgets.php:865
 `sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode(
 get_block_categories( 'widgets-customizer' ) ) ),`

 In these two places, `get_block_categories()` is being passed a string
 instead of the required `WP_Post` or `WP_Block_Editor_Context` instance.
 The string is causing a fatal error due to the type hinting on my function
 for the `block_categories_all` filter.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53757>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list