Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#11 | context-2742913-11.patch | 934 bytes | Andrey Inkin |
#5 | context-2742913-5.patch | 843 bytes | raphaelhuefner |
Comments
Comment #2
chishah92 CreditAttribution: chishah92 at Blisstering Solutions commentedI simply installed the module , but couldn't replicate the issue . It would be great if you provide steps to replicate in steps.
Comment #3
jlbretton CreditAttribution: jlbretton commentedI 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.
Comment #4
hass CreditAttribution: hass commentedShould be simple to fix. Will share a patch that checks if isset.
Comment #5
raphaelhuefner CreditAttribution: raphaelhuefner at Affinity Bridge commentedPreliminary patch with
isset()
.Comment #6
hass CreditAttribution: hass commentedDoes this work?
Comment #7
jlbretton CreditAttribution: jlbretton commentedYes, perfect, patch from #5 works.
Many thanks.
Comment #9
hass CreditAttribution: hass commentedComment #11
Andrey Inkin CreditAttribution: Andrey Inkin as a volunteer commentedThe patch from raphaelhuefner prevents the active class to be set if no classes were added prior. The following patch fixes the problem.
Comment #12
rsvelko CreditAttribution: rsvelko as a volunteer commented+1 for #11: I wrote a PM to @raphaelhuefner.
Comment #13
raphaelhuefner CreditAttribution: raphaelhuefner at Affinity Bridge commentedThank 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.
Comment #14
rsvelko CreditAttribution: rsvelko as a volunteer commented@raphaelhuefner, are you going to re-open the issue, undo the patch from #5 and commit the #11 patch in the codebase?
Comment #15
giupenni CreditAttribution: giupenni commented#11 works for me
Comment #16
zrpnr#11 worked for me, thanks raphaelhuefner and andrey
Comment #17
jweakley CreditAttribution: jweakley commentedinstalling 7.x-3.x-dev fixed the "Notice:" errors I was getting
Comment #18
loopduplicateThe 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
Comment #19
JamesOakleyAdded 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
Comment #20
JamesOakley