I got this error when upgrading to PHP 7.4:

Notice: Trying to access array offset on value of type bool in _menu_block_format_title() (line 178 of /var/www/html/sites/all/modules/contrib/menu_block/menu_block.admin.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

samberry created an issue. See original summary.

samberry’s picture

samberry’s picture

Title: Notice: Trying to access array offset on value of type bool in _menu_block_format_title() (line 178 of /var/www/html/sites/all/modules/contrib/menu_block/menu_block.admin.inc). » Notice: Trying to access array offset on value of type bool in _menu_block_format_title() (line 177 of /var/www/html/sites/all/modules/contrib/menu_block/menu_block.admin.inc).
brad.bulger’s picture

What were you trying to do when you got this? I'm seeing a similar error in the module file on PHP 7.4, but I can't recreate this one. There's a similar case in menu_tree_block_data() that gets reported to watchdog as an error, which makes sense to me. If the parent mlid is not empty but does not load a value, that seems like a problem.

joelpittet’s picture

Version: 7.x-2.8 » 7.x-2.x-dev
Status: Active » Needs review
brad.bulger’s picture

I hadn't seen that but yes that's the same change that I'd made to menu_block_tree_output(). This issue in _menu_block_format_title() seems different. I can't recreate it, but it looks like an actual error if that menu_link_load() call fails - like, that something is wrong with the menu or something. I'm just being nosy.

joelpittet’s picture

Title: Notice: Trying to access array offset on value of type bool in _menu_block_format_title() (line 177 of /var/www/html/sites/all/modules/contrib/menu_block/menu_block.admin.inc). » Notice: Trying to access array offset on value of type bool in _menu_block_format_title()
Assigned: samberry » Unassigned
Status: Needs review » Fixed

I fixed the indent on this but I think it follows, if the menu link can't be loaded for some reason it will be hard pressed to get the title. Thanks @samberry

  • joelpittet committed 386fe3b on 7.x-2.x authored by samberry
    Issue #3178543 by samberry, brad.bulger, joelpittet: Notice: Trying to...
joelpittet’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

wylbur’s picture

Issue tags: +PHP 7.4

Adding PHP 7.4 issue tag