Bug in Drupal...no blogs...

After upgrading PHP, Perl, Apache etc, I found out I could no longer blog with Drupal. After a lot of fighting, use of Google etc, I fould out it was not only me having problems.

After a while, I found a patch someone had applied, and I took the chance of applying it. Note that patch did not like the format of the patch itself, so emacs had to do the job.

See this thread for discussions, and this patch.


Index: includes/session.inc
===================================================================
--- includes/session.inc	(revision 103)
+++ includes/session.inc	(working copy)
@@ -43,12 +43,16 @@
   else {
     $user->roles[DRUPAL\_ANONYMOUS\_RID] = 'anonymous user';
   }
+  $GLOBALS['account'] = (array)$user;

   return !empty($user->session) ? $user->session : '';
 }

 function sess\_write($key, $value) {
-  global $user;
+  global $account, $user;
+  if (empty($user)) {
+    $user = (object)$account;
+  }

   $result = db\_query("SELECT sid FROM {sessions} WHERE sid = '%s'", $key);