[wp-trac] [WordPress Trac] #58823: Editor: Incorrect error handling when converting classic to block menus
WordPress Trac
noreply at wordpress.org
Mon Jul 17 18:10:04 UTC 2023
#58823: Editor: Incorrect error handling when converting classic to block menus
--------------------------+-----------------------------
Reporter: dlh | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Originally filed as https://github.com/WordPress/gutenberg/issues/52481:
Some errors that can occur when
`WP_Navigation_Fallback::create_classic_menu_fallback()` calls
`WP_Classic_To_Block_Menu_Converter::convert()` aren't handled as
accurately as they could be.
1. `::convert()` can return a `WP_Error` object, but this error object
won't be detected by the `empty()` check in
`::create_classic_menu_fallback()`. The `WP_Error` return type is also
missing from the docs.
2. `::convert()` returns an array instead of a string when no menu items
are returned by `wp_get_nav_menu_items()`.
See here: https://github.com/WordPress/wordpress-
develop/blob/be1cb4583abc8d0870506dfeec9aad7f6cf82c7e/src/wp-includes
/class-wp-navigation-fallback.php#L105-L110
and here: https://github.com/WordPress/wordpress-
develop/blob/be1cb4583abc8d0870506dfeec9aad7f6cf82c7e/src/wp-includes
/class-wp-classic-to-block-menu-converter.php#L17-L56
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58823>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list