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.
Invalid argument supplied for foreach() in /home/oursite/html/sites/all/modules/user_badges/user_badges.module on line 215.
referer: http://www.oursite.com/user/register
We just noticed these popping up in the log files. Does anyone know what may be causing this or how to fix it.
Thanks for any input
Comments
Comment #1
sjorgnsn CreditAttribution: sjorgnsn commentedditto - subscribing and I might look into it myself.
Comment #2
venusrising CreditAttribution: venusrising commented@sjorgnsn
I have been looking but cannot figure out the issue.
Comment #3
BeatleMike CreditAttribution: BeatleMike commentedI have the same issue, it seems to randomly pop up everywhere, even pages that would never display a badge. It's even more prevalent just after a server reboot.
This revision of the module is from November 2010, perhaps it's an issue with other modules running? Are either of you running userpoints?
Comment #4
tyrusmanuel CreditAttribution: tyrusmanuel commentedsubscribing, getting them after a new user registers especially, including as a message on my homepage.
Also getting warning: key_exists() expects parameter 2 to be array, null given in C:\xampp\htdocs\coax\modules\user_badges\user_badges.module on line 244.
Comment #5
tyrusmanuel CreditAttribution: tyrusmanuel commentedSee this post also, haven't tested the patches or tested any dev versions yet, but they seem to have fixed this issue and mine as well:
http://drupal.org/node/964546
Comment #6
tyrusmanuel CreditAttribution: tyrusmanuel commentedThe dev version fixed the line 215 error for me when a new user registers, I am still having the "key exists" error for line 244 however.
Comment #7
tyrusmanuel CreditAttribution: tyrusmanuel commentedNow also seeing this error warning: Illegal offset type in C:\xampp\htdocs\coax\modules\user_badges\user_badges.module on line 275. After changing a users role in the admin interface.
Comment #8
venusrising CreditAttribution: venusrising commentedOkay we too are seeing after someone tries to register. Had a hard time re-creating this but after reading the above code we looked at the logs and is showing being generated on registration.
User Visitor
Location http://www.oursite.com/user/register
Referrer http://www.oursite.com/user/register
Message Invalid argument supplied for foreach() in /home/oursite/html/sites/all/modules/user_badges/user_badges.module on line 215.
Severity error
Comment #9
venusrising CreditAttribution: venusrising commentedI used the patch for the other badges all issue but it does not correct this DB error issue.
Comment #10
boftx CreditAttribution: boftx commentedSubscribe
Comment #11
jsidigital CreditAttribution: jsidigital commentedAnyone find a fix for this yet?
I get it after new users register.
how can we avoid this message?
Thanx.
Comment #12
jsidigital CreditAttribution: jsidigital commentedOk. The 215 error i fixed by following this:
http://drupal.org/node/964546#comment-3717306
However, i still cannot find a fix for the 248 error.
warning: key_exists() [function.key-exists]: The second argument should be either an array or an object in /home/jsi/public_html/sites/all/modules/user_badges/user_badges.module on line 248.
Anyone else seeing this after a registration? Do we even know what is causing it?
Comment #13
dunx CreditAttribution: dunx commentedThe function call should be using array_key_exists, not key_exists. Not that this fixes the issues, but key_exists is deprecated. Other issues may be PHP5.3 related.
Comment #14
shabana.navas CreditAttribution: shabana.navas commentedFixed in Version 7. Please upgrade to Version 7.x-3.x.