Every time the Drupal cache is cleared, hook_menu_alter is invoked.
Inside function view_mode_page_menu_alter() on line 149 the code follow code which causes a PHP warning:
// if this view mode is not in use, we shouldn't use it
if (!in_array($view_mode, $view_modes[$entity_type]) && $view_mode != 'default') {
$missing_view_modes[] = $page;
continue;
}
Presumably, $view_modes[$entity_type] is null at times, which causes the following warning to be displayed:
in_array() expects parameter 2 to be array, null given view_mode_page.module:149
I'm noticing this when clearing cache via Drush, however even without Drush the warning will be written into the watchdog log.
The code still functions as intended, since the resulting expression is still false, but it would be nice to get rid of the warning.
Comments
Comment #1
justindodge commentedComment #3
rballou commentedI've added a potential fix to the dev branch, so check it out and let me know if it fixes it. Thanks!
Comment #4
justindodge commentedThanks for your quick response rballou. The fix resolves the issue I reported and the code looks good to me.
Comment #5
rballou commentedApplied to 7.x-2.4 (just created). Thanks!