I was inspecting our logs today an noticed this warning occurring a few times
Warning: in_array() expects parameter 2 to be array, string given in context_menu_tree_add_active_path() (line 128 of /var/www/html/sites/all/modules/context_menu_block/context_menu_block.module).
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 2415167-12.patch | 6.34 KB | vuil |
Comments
Comment #1
amarcus commentedI'm not sure what line 128 is supposed to do. It appears that the code is expecting $active_path to be an array including elements such as "main-menu:taxonony/term/5" whereas it seems to actually just be "taxonomy/term/5".
Here's a patch that tests for for it to be an array or a string.
Comment #2
lexmccurry4x3 commentedWe also had a similar Warning, on the first two sites we updated from 7.x-3.1-b3 to 7.x-3.1.
However this warning was visible to the public on a few pages with missing content. Reverting to the Previous 7.x-3.1-b3 resolved this issue:
Warning: in_array() expects parameter 2 to be array, string given in context_menu_tree_add_active_path() (line 128 of sites/all/modules/context_menu_block/context_menu_block.module)
Comment #3
floown commentedHello,
I have the same issu : message error : Warning : in_array() expects parameter 2 to be array, string given dans context_menu_tree_add_active_path() (ligne 128 dans /home/admin/web/mydomain.com/public_html/sites/all/modules/context_menu_block/context_menu_block.module).
I have try to apply the patch, but I can not :
I have try without -p1 parameter :
Help please.
Comment #4
welly commentedLatest versions of Drupal, Context, Menu Block and Context Menu Block are failing to report any errors or warnings. Can you try updating to the latest versions and let me know how you get on.
Comment #5
markplindsay commentedFor the benefit of others who arrive here via Google, I am getting this as well with Drupal 7.52, Context 7.x-3.7, Menu block 7.x-2.7, and Context: Menu Block 7.x-3.1.
It's been a long while since I worked on the code that uses the context_menu_block module. So, like amarcus commented, I am not sure what line 128 is supposed to be doing either.
Rather than patch up the latest version I reverted to Context: Menu Block 7.x-3.1-beta3 and all is well once again.
Comment #6
wylbur commentedThe code in line 128 is using in_array, but is looking at a string. I used a strcmp function to compare see if the menu item is the same as the node alias. If this is true, the active menu trail is set.
If you are seeing this error, applying the patch will resolve the error, and set the active menu path correctly.
Comment #7
wylbur commentedAdding patch file with commit number in name.
Comment #8
wylbur commentedComment #9
borisson_I had the same error, applied the patch in #7 on the latest versions of core, context and context menu block and now it works.
Comment #10
borisson_Looks like this patch is giving us problems on another path. So reverted it from my install. Will post back if I find a better solution.
Comment #11
borisson_Looks like resaving the contexts with correct configuration fixed it for me, I removed this patch and it worked as it's supposed to. Should've figured that out the first time.
I think that means this issue is not needed, but not sure.
Comment #12
vuilResolve the issue with:
Also update the all
http://drupal.org/xxxwithhttps://drupal.org/xxx.Comment #14
vuilI close the issue as Fixed.