In sess_read one tries to find in the session table the data belonging to the current session.

If no session is found, one insert a new row into the session table. The value inserted for the user ID is the value of $user->uid.

In PHP 5 this action gives the following error:
Notice: Trying to get property of non-object in \includes\session.inc on line 27.

As there's no session, we don't know who is the user, and the user to be noted in the insert is the anonymous user, number 0.

CommentFileSizeAuthor
#4 postgres_session_inc.diff871 bytesadrian
session.inc_1.patch1.01 KBadschar
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

killes@www.drop.org’s picture

I think the patch is reversed and needs to be applied with -R. It should be applied to 4.5 and HEAD.

Dries’s picture

Committed a slightly different fix to both HEAD and DRUPAL-4-5.

Anonymous’s picture

adrian’s picture

Priority: Normal » Critical
FileSize
871 bytes

This patch breaks postgres.

The uid field is defined as not null, and hence leaving out the $user->uid in the insert statement causes update.php to not even load.

Attached is a 1 line patch with the user id column added back.

adschar’s picture

This thread started when I noticed that in absence of a session, one does not have a user object. I tested in a PHP5 environment. There it noticed the non-object.

Adrian/Dries, is there any objection to hardcoding the value 0 when there's no session, and thus no user? That was the point of my original patch.

killes@www.drop.org’s picture

Component: base system » postgresql database
Priority: Critical » Normal
Status: Active » Needs review

moving to postgres, probably duplicate

Cvbge’s picture

Status: Needs review » Fixed

The value 0 is currently hardcoded, I haven't noticed any errors - thus marking as fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)