I have got this error message: notice: Undefined property: stdClass::$sid in su_comments_user() (line 72 of /sites/all/modules/contrib/su_comments/su_comments.module).

I am using php 5.3.

Comments

mibfire’s picture

Priority: Major » Normal
AlexisWilke’s picture

This error, in itself, is not too much of a problem, although I'm wondering why 'sid' is expected to be defined.

But the test in the if() statements are incorrect.

	static $old_sid = false;
	if ($op = 'load'){   // one '=' !!! should be 2
		/* on user load we have still old session id
		 * (which is regenerated later by the core)
		 * but uid is already valid */
		$old_sid = $account->sid;  // <- this is the line that generates the warning as found by mibfire
	} else if ($op = 'login' && $old_sid) {   // one '=' !!! again, should be 2
		/* on user login the session id has already been regenerated
		 * so now we can update our comments table */
		$query = "UPDATE {comments_sessions} SET sid = '%s' WHERE sid = '%s'";
		db_query($query, $old_sid, $account->sid);
	}

This means the intended UPDATE never occurs because the first if() is always true.