Incorrect error handling when converting classic to block menus #52481
Labels
[Block] Navigation
Affects the Navigation Block
Needs Testing
Needs further testing to be confirmed.
[Status] Stale
Gives the original author opportunity to update before closing. Can be reopened as needed.
[Type] Bug
An existing feature does not function as intended
Description
Some errors that can occur when
Gutenberg_Navigation_Fallback::create_classic_menu_fallback()
callsGutenberg_Classic_To_Block_Menu_Converter::convert()
aren't handled as accurately as they could be.::convert()
can return aWP_Error
object, but this error object won't be detected by theempty()
check in::create_classic_menu_fallback()
. TheWP_Error
return type is also missing from the docs.::convert()
returns an array instead of a string when no menu items are returned bywp_get_nav_menu_items()
.See here:
gutenberg/lib/compat/wordpress-6.3/class-gutenberg-navigation-fallback.php
Lines 90 to 118 in 92dd32e
and here:
gutenberg/lib/compat/wordpress-6.3/class-gutenberg-classic-to-block-menu-converter.php
Lines 16 to 53 in 92dd32e
Step-by-step reproduction instructions
n/a
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
The text was updated successfully, but these errors were encountered: