I am getting the following error messages:

Notice: Undefined index: attributes in context_preprocess_menu_link() (line 247 of /srv/bindings/[mysite]/code/sites/all/modules/context/context.module).
Warning: in_array() expects parameter 2 to be array, null given in context_preprocess_menu_link() (line 247 of /srv/bindings/[mysite]/code/sites/all/modules/context/context.module).

Does anyone have any insight into what might be causing these messages and whether there is something I should do on my end to avoid them?

Thank you.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jsibley created an issue. See original summary.

chishah92’s picture

I simply installed the module , but couldn't replicate the issue . It would be great if you provide steps to replicate in steps.

jlbretton’s picture

I have the same message after updating context from 7.x-3.6 to 7.x-3.7 and Drupal to 7.43. This happen on my locale development website and on the production one.
The error appears on pages without menu links but with the following context:
Conditions:
- type of node: xxxx
Reactions:
- block: xxxx
- Menu: (Control menu active class using context.)
-- menu 1 (menu not highlighted in context)
--- menu 1.1 (menu highlighted in context)

Except the fact that the concern type of node, which generates this error, doesn't have a menu, the other "special" thing I can think about it is that it has the Date module present and active in it.
Adding a menu to the node type and then to the page, doesn't change the issue.
Many thanks.

hass’s picture

Version: 7.x-3.7 » 7.x-3.x-dev
Category: Support request » Bug report

Should be simple to fix. Will share a patch that checks if isset.

raphaelhuefner’s picture

hass’s picture

Status: Active » Needs review

Does this work?

jlbretton’s picture

Yes, perfect, patch from #5 works.
Many thanks.

  • hass committed a514daa on 7.x-3.x authored by raphaelhuefner
    Issue #2742913 by raphaelhuefner: Warning and notice from line 247
    
hass’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

Andrey Inkin’s picture

FileSize
934 bytes

The patch from raphaelhuefner prevents the active class to be set if no classes were added prior. The following patch fixes the problem.

rsvelko’s picture

+1 for #11: I wrote a PM to @raphaelhuefner.

raphaelhuefner’s picture

Thank you rsvelko for reaching out!

Andrey's solution is better for exactly the reason he described in #11, so please discard my patch from #5.

rsvelko’s picture

@raphaelhuefner, are you going to re-open the issue, undo the patch from #5 and commit the #11 patch in the codebase?

giupenni’s picture

#11 works for me

zrpnr’s picture

#11 worked for me, thanks raphaelhuefner and andrey

jweakley’s picture

installing 7.x-3.x-dev fixed the "Notice:" errors I was getting

loopduplicate’s picture

The patch from #11 works against 7.x-3.6 but not against the current dev release. So, I've created a new issue and rerolled #11, https://www.drupal.org/project/context/issues/2979505#comment-12651518

JamesOakley’s picture

Added a request at #3014980: Warning and notice from line 247, version 2 for this to be reopened so it can be fixed as at #11. Only #5 got committed

JamesOakley’s picture