Trying to access array offset on value of type null in the WeMegaMenuBuilder::dragDropMenuItems (line 607)

Created on 4 August 2023, over 1 year ago

Problem/Motivation

I got message

Warning: Trying to access array offset on value of type null in Drupal\we_megamenu\WeMegaMenuBuilder::dragDropMenuItems() (line 607 of /var/www/docroot/modules/contrib/we_megamenu/src/WeMegaMenuBuilder.php)

Steps to reproduce

Open standart settings of menu items order.
Try to disable items in the tree (if you have the tree of items) or change ot order. It also were happen on order change.

I did reproduce it one time. If you will go to the menu settings form of megamenu and click 'save' - the problem is gone.

Proposed resolution

Seems, you need to add the check for empty value. It looks like a loop tying get the array item by key, but it's empty.
It's crashing on this code line
if (is_object($menu_config->menu_config->{$key_menu}->rows_content[$row_count][$col_count]->col_content)) {

πŸ› Bug report
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine t1mm1 Kiev

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

Comments & Activities

Production build 0.71.5 2024