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

sjorgnsn’s picture

ditto - subscribing and I might look into it myself.

venusrising’s picture

@sjorgnsn
I have been looking but cannot figure out the issue.

BeatleMike’s picture

I 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?

tyrusmanuel’s picture

subscribing, 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.

tyrusmanuel’s picture

See 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

tyrusmanuel’s picture

The 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.

tyrusmanuel’s picture

Now 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.

venusrising’s picture

Okay 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

venusrising’s picture

I used the patch for the other badges all issue but it does not correct this DB error issue.

boftx’s picture

Subscribe

jsidigital’s picture

Anyone find a fix for this yet?

I get it after new users register.
how can we avoid this message?

Thanx.

jsidigital’s picture

Ok. 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?

dunx’s picture

The 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.

shabana.navas’s picture

Status: Active » Closed (fixed)

Fixed in Version 7. Please upgrade to Version 7.x-3.x.