? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1110
diff -u -p -r1.1110 node.module
--- modules/node/node.module	24 Aug 2009 00:14:21 -0000	1.1110
+++ modules/node/node.module	24 Aug 2009 19:27:04 -0000
@@ -799,21 +799,25 @@ function node_load_multiple($nids = arra
 
     // The columns vid, title, status, comment, promote, moderate, and sticky
     // are all provided by node_revision, so remove them.
-    foreach (array('vid', 'title', 'status', 'comment', 'promote', 'moderate', 'sticky') as $column) {
-      unset($node_fields[$column]);
-    }
+    $node_fields = array_diff($node_fields, array('vid', 'title', 'status', 'comment', 'promote', 'moderate', 'sticky'));
     $query->fields('n', $node_fields);
 
     // Add all fields from the {node_revision} table.
     $node_revision_fields = drupal_schema_fields_sql('node_revision');
 
-    // nid is provided by node, so remove it.
-    unset($node_revision_fields['nid']);
+    // {node_revision}.nid is provided by node, and {node_revision}.uid and
+    // {node_revision}.timestamp will be added with aliases, so remove them
+    // before adding to the query.
+    $node_revision_fields = array_diff($node_revision_fields, array('nid', 'uid', 'timestamp'));
+    $query->fields('r', $node_revision_fields);
+
+    // Add {node_revision}.uid with alias revision_uid to avoid the name
+    // collision with {node}.uid, otherwise the revision author would be loaded
+    // as $node->uid.
+    $query->addField('r', 'uid', 'revision_uid');
 
-    // Change timestamp to revision_timestamp before adding it to the query.
-    unset($node_revision_fields['timestamp']);
+    // Add {node_revision}.timestamp with alias revision_timestamp for clarity.
     $query->addField('r', 'timestamp', 'revision_timestamp');
-    $query->fields('r', $node_revision_fields);
 
     if ($nids) {
       $query->condition('n.nid', $nids, 'IN');
Index: modules/node/node.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.test,v
retrieving revision 1.41
diff -u -p -r1.41 node.test
--- modules/node/node.test	23 Aug 2009 04:37:52 -0000	1.41
+++ modules/node/node.test	24 Aug 2009 19:27:04 -0000
@@ -219,6 +219,29 @@ class PageEditTestCase extends DrupalWeb
     // Check that the title and body fields are displayed with the updated values.
     $this->assertText($edit['title'], t('Title displayed.'));
     $this->assertText($edit[$body_key], t('Body displayed.'));
+
+    // Login as a second administrator user.
+    $second_web_user = $this->drupalCreateUser(array('administer nodes', 'edit any page content'));
+    $this->drupalLogin($second_web_user);
+    // Edit the same node, creating a new revision.
+    $this->drupalGet("node/$node->nid/edit");
+    $edit = array();
+    $edit['title'] = $this->randomName(8);
+    $edit[$body_key] = $this->randomName(16);
+    $edit['revision'] = TRUE;
+    $this->drupalPost(NULL, $edit, t('Save'));
+
+    // Ensure that the node revision has been created.
+    $revised_node = $this->drupalGetNodeByTitle($edit['title']);
+    $this->assertNotIdentical($node->vid, $revised_node->vid, 'A new revision has been created.');
+    // Ensure that the node author is preserved when it was not changed in the
+    // edit form.
+    $this->assertIdentical($node->uid, $revised_node->uid, 'The node author has been preserved.');
+    // Ensure that the revision authors are different since the revisions were
+    // made by different users.
+    $first_node_version = node_load($node->nid, $node->vid);
+    $second_node_version = node_load($node->nid, $revised_node->vid);
+    $this->assertNotIdentical($first_node_version->revision_uid, $second_node_version->revision_uid, 'Each revision has a distinct user.');
   }
 }
 
Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.56
diff -u -p -r1.56 user.test
--- modules/user/user.test	21 Aug 2009 14:27:47 -0000	1.56
+++ modules/user/user.test	24 Aug 2009 19:27:04 -0000
@@ -479,7 +479,7 @@ class UserCancelTestCase extends DrupalW
     $test_node = node_load($node->nid, NULL, TRUE);
     $this->assertTrue(($test_node->uid == 0 && $test_node->status == 1), t('Node of the user has been attributed to anonymous user.'));
     $test_node = node_load($revision_node->nid, $revision, TRUE);
-    $this->assertTrue(($test_node->uid == 0 && $test_node->status == 1), t('Node revision of the user has been attributed to anonymous user.'));
+    $this->assertTrue(($test_node->revision_uid == 0 && $test_node->status == 1), t('Node revision of the user has been attributed to anonymous user.'));
     $test_node = node_load($revision_node->nid, NULL, TRUE);
     $this->assertTrue(($test_node->uid != 0 && $test_node->status == 1), t("Current revision of the user's node was not attributed to anonymous user."));
 
