- Merge request !1Issue #3220332: Fatal error when un-checking the "Provide a menu link" checkbox on a node form → (Closed) created by akalam
When you try to uncheck the "Provide a menu link" checkbox on a node having a menu link, you get the following error:
Error: Call to a member function delete() on null in menu_ui_form_node_form_submit() (line 335 of core/modules/menu_ui/menu_ui.module).
menu_ui_form_node_form_submit(Array, Object)
call_user_func_array('menu_ui_form_node_form_submit', Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('node_FOO_edit_form', Array, Object) (Line: 321)
If you reload the page, you would realize the menu_link had been successfully deleted
The reason is the menu_ui_form_node_form_submit() function being executed twice. So during the second call the menu link is already deleted.
- Install the module
- Create a node with a menu link
- Edit the node and uncheck the "Provide a menu link" checkbox
- save
Remove the code adding the 'menu_ui_form_node_form_submit' as a submit callback, because that function is already un the #submit stack
Test & review
None
None
None
Closed: duplicate
1.0
Code
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.