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'm getting the following error after installing the module:
Notice: Trying to get property of non-object in config_perms_menu_alter() (line 109 of /var/www/dev/sites/all/modules/contrib/config_perms/config_perms.module).
Warning: Invalid argument supplied for foreach() in config_perms_menu_alter() (line 109 of /var/www/dev/sites/all/modules/contrib/config_perms/config_perms.module).
I also get this same error any time I clear the cache. Any ideas?
Thanks,
Ben
Comment | File | Size | Author |
---|---|---|---|
#8 | config_perms-hook-menu-alter-non-object-1274800-8.patch | 618 bytes | anniegreens |
#6 | config_perms-1274800.patch | 618 bytes | jonhattan |
Comments
Comment #1
jibize CreditAttribution: jibize commentedHi there,
I'm having the same issue...
Comment #2
askibinski CreditAttribution: askibinski commentedsub
Comment #3
jason.fisher CreditAttribution: jason.fisher commentedSame issue in 6.x .. this is blocking Aegir.
Comment #4
Jaapx CreditAttribution: Jaapx commentedAlso having this problem, I did a little debugging. Because I'm not familair with creating patches as recommended I describe the solution in the simple way.
In config_perms/config_perms.module change the function 'function config_perms_perms()' in:
function config_perms_perms($machine_name = NULL, $rebuild = FALSE) {
// Load current perms
// $perms = cache_get('config_perms');
// Rebuild if not there
// if (!$perms || $rebuild) {
$perms = config_perms_cache_rebuild();
// }
return ($machine_name) ? $perms[$machine_name] : $perms;
}
I'm not familair with the function 'cache_get' but I suppose that this function call is the cause of the problem. By unconditionally calling config_perms_cache_rebuild() this problem is circumvented. There must be a better solution but this one works, not unimportant!
Comment #5
richard.wyke CreditAttribution: richard.wyke commentedI think this is because of the way cache_get returns data as an object which config_perms_menu_alter isn't expecting, a fix here to get from the cache properly:
Change:
Comment #6
jonhattanSolution in #5 just works.
Attached a patch implementing #5.
Comment #7
3rdLOF CreditAttribution: 3rdLOF commentedLast Patch did it.
Many thanks
Comment #8
anniegreens CreditAttribution: anniegreens commentedAttached patch re-rolled with correct Drupal standard file permissions (644).
Comment #9
dkingofpa CreditAttribution: dkingofpa commentedPatch in #8 fixed my issue. I wasn't getting the exact same error message, but it was on the same line and this patch worked.
Comment #10
jonhattanComment #11
Leeteq CreditAttribution: Leeteq commentedTime to push this one to the -dev branch?
Comment #12
rooby CreditAttribution: rooby commentedWorks for me too and the patch looks good. +1 for RTBC
Comment #13
barraponto CreditAttribution: barraponto commented+1 for RTBC.Not working for me on a Panopoly install. Yet works fine on simplytest.me.Comment #14
barraponto CreditAttribution: barraponto commentedBTW, this patch depends on the fix commited in #1229198: Invalid argument supplied for foreach() - config_perms.module
Comment #15
drupov CreditAttribution: drupov commentedPatch from #8 works against the latest dev.
Comment #16
druplr CreditAttribution: druplr commented#8 Fixed the the following error on admin/people with 7.x-2.0+4-dev.
Notice: Trying to get property of non-object in config_perms_permission() (line 55 of .../modules/o_contrib_seven/config_perms/config_perms.module).
+1 for RTBC
Comment #17
tanmayk#8 works against latest dev.
+1 for RTBC
Comment #18
mlncn CreditAttribution: mlncn commentedThis is also a duplicate of #2200925: On cache clear: Invalid argument supplied for foreach() - config_perms.module (though i didn't realize until i went to apply it).
Unless i'm missing something?