Log => Notice: Trying to get property of non-object in sess_user_load() -> memcache-session.inc
Fix: (edit memcache-session.inc)
function sess_user_load($session) {
// We found the client's session record and they are an authenticated user.
if ($session && $session->uid != 0) {
$user = dmemcache_get($session->uid, 'users');
// If the 'users' memcache bin is unavailable, $user will be NULL.
// If the cached user was not found in the 'users' memcache bin, $user will
// be FALSE.
// In either of these cases, the user must be retrieved from the database.
- if (!$user->uid && isset($session->uid) && $session->uid != 0) {
+ if (empty($user->uid) && isset($session->uid) && $session->uid != 0) {
$user = db_fetch_object(db_query('SELECT u.* FROM {users} u WHERE u.uid = %d', $session->uid));
if (!$user->status) {
$user = drupal_anonymous_user($session->session);
}
else {
Comments
Comment #1
mikeytown2 commentedpatch also contains white space fixes.
Comment #2
jeffsheltren commentedI'm unable to reproduce the notice under php 5.3 with errors/notices enabled, so I'm not sure what that's about, but your patch works for me and seems valid.
Comment #3
jeremy commentedThanks! Patch committed:
http://drupalcode.org/project/memcache.git/commit/313280d