$user->session_data_present_at_load is never set in sess_write()

Scott Reynolds - September 14, 2009 - 18:12
Project:Memcache API and Integration
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

The reason is incredibly simple. That value is set on sess_read().

in sess_write()

<?php
$user
= sess_user_load($session);
?>

Thus, overriding the user object, and removing session_data_present_at_load. Not sure what the goal of this property is, but should consider,
1.) instead of setting it at sess_read() set it at sess_user_load()
2.) something like this feels like a work around for performance. Feels like there should be a better way..

#1

Scott Reynolds - September 14, 2009 - 18:34

even further...

<?php
if ($user->uid || !empty($value) || empty($value) && (!isset($user->session_data_present_at_load) || $user->session_data_present_at_load))
?>

Will always evaluate to true (!empty($value) || empty($value))

I believe that was suppose to be

<?php
// If this is an authenticated user, or there is something to save in the
  // session, or this is an anonymous user who currently has nothing in the
  // session but did have something in session storage, write it to memcache.
  // If $user->session_data_present_at_load is not set, the current user
  // was created during this request and it's safest to do a write.
  // Cases 1b, 1d, 2a, and 2b are covered here.
if (($user->uid && !empty($value)) || ($user->uid == 0 && empty($value))
?>

But i think im still messing it up. Maybe its not a bug, worth a second look

At the bare minimum this is equivalent

<?php
if ($user->uid  && (!isset($user->session_data_present_at_load) || $user->session_data_present_at_load))
?>

 
 

Drupal is a registered trademark of Dries Buytaert.