diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentBookTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentBookTest.php index 4d92e9d..a8847f4 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentBookTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentBookTest.php @@ -45,6 +45,7 @@ public function testBookCommentPrint() { 'type' => 'book', 'title' => 'Book title', 'body' => 'Book body', + 'status' => NODE_PUBLISHED, )); $book_node->book['bid'] = 'new'; $book_node->save(); diff --git a/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php index c8544f6..3d6b87e 100644 --- a/core/modules/node/lib/Drupal/node/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Node.php @@ -94,6 +94,10 @@ public function preSaveRevision(EntityStorageInterface $storage, \stdClass $reco if (!isset($record->log)) { $record->log = ''; } + // Ensure we have a valid value for the revision author. + if (!isset($record->revision_uid)) { + $record->revision_uid = 0; + } } elseif (isset($this->original) && (!isset($record->log) || $record->log === '')) { // If we are updating an existing node without adding a new revision, we