Warning: Trying to access array offset on value of type null in menu_form_node_form_alter()

Created on 15 August 2023, about 1 year ago

Problem/Motivation

I can see multiple PHP warnings when editing a node:

Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 691 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 702 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 714 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 728 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 728 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 728 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 728 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 728 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 728 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 728 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 728 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 728 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 735 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 746 of /var/www/html/docroot/modules/menu/menu.module).
Warning: Trying to access array offset on value of type null in menu_form_node_form_alter() (line 778 of /var/www/html/docroot/modules/menu/menu.module).

Steps to reproduce

Edit a node that does not have a menu link.

Proposed resolution

Check whether the menu link value is null before trying to use it.

πŸ› Bug report
Status

Closed: works as designed

Version

7.0 ⚰️

Component
Menu systemΒ  β†’

Last updated about 21 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom colinstillwell

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024