Clicking 'edit menu' link causes PHP warning 'Trying to access array offset on value of type bool'

Created on 19 May 2023, over 1 year ago
Updated 14 June 2023, over 1 year ago

Problem/Motivation

Clicking 'edit menu' link at https://<MY_SITE>/admin/structure/menu causes the following PHP warning

Warning: Trying to access array offset on value of type bool in
og_menu_form_menu_edit_menu_alter() (line 526 of
/.../public/sites/all/modules/contrib/og_menu/og_menu.module).
🐛 Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

🇨🇦Canada franceslui

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

Comments & Activities

  • Issue created by @franceslui
  • 🇨🇦Canada franceslui

    In the function og_menu_form_menu_edit_menu_alter of the module og_menu.module, $ogm is false at line 526 if users edit regular menus (i.e. non-OG menus). To fix this bug, I have modified the code to check if $ogm is not false before retrieving its array item. Please see my attached patch. Thank you.

  • Status changed to RTBC over 1 year ago
  • 🇨🇦Canada joelpittet Vancouver

    I've reviewed this code with franceslui and it seems to be overstepping when it doesn't have a group id. Thanks @franceslui for posting the patch.

Production build 0.71.5 2024