[wp-trac] [WordPress Trac] #58823: Editor: Incorrect error handling when converting classic to block menus

WordPress Trac noreply at wordpress.org
Mon Aug 21 17:49:24 UTC 2023


#58823: Editor: Incorrect error handling when converting classic to block menus
---------------------------------------------+-----------------------------
 Reporter:  dlh                              |       Owner:  hellofromTonya
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  6.3.1
Component:  Editor                           |     Version:  6.3
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+-----------------------------
Changes (by hellofromTonya):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56422" 56422]:
 {{{
 #!CommitTicketReference repository="" revision="56422"
 Editor: Fix error handling of converting classic to block menus.

 Fixes the error handling for when
 `WP_Classic_To_Block_Menu_Converter::convert()` returns an instance of
 `WP_Error`. `WP_Navigation_Fallback::create_classic_menu_fallback()` now
 checks for `is_wp_error()` and if `true`, returns the error. And the
 `@return` type is updated to `string|WP_Error`.

 Also includes a fix in the return type in
 `WP_Classic_To_Block_Menu_Converter::convert()` to return an empty string
 instead of an array instead, i.e. when bailing out for no menu items
 returned by `wp_get_nav_menu_items()`. The return type is clearly
 documented as a `string`.

 Follow-up to [56052].

 Props dlh, get_dave, antonvlasenko, hellofromTonya.
 Fixes #58823.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58823#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list