diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php
index 51a6cce..b862f54 100644
--- a/core/modules/comment/src/CommentForm.php
+++ b/core/modules/comment/src/CommentForm.php
@@ -281,15 +281,15 @@ public function buildEntity(array $form, FormStateInterface $form_state) {
         // the author ID is anonymous.
         $comment->setAuthorName($form_state->getValue('name'));
       }
-      else {
-        // Ensure the author name is not set.
-        $comment->setAuthorName(NULL);
-      }
     }
     else {
       $author_id = $this->currentUser->id();
     }
     $comment->setOwnerId($author_id);
+    if ($author_id > 0) {
+      // Update author name for authorized user.
+      $comment->setAuthorName($comment->getAuthorName());
+    }
 
     // Validate the comment's subject. If not specified, extract from comment
     // body.
diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php
index e2ab3d8..2c374a5 100644
--- a/core/modules/comment/src/Entity/Comment.php
+++ b/core/modules/comment/src/Entity/Comment.php
@@ -545,8 +545,8 @@ public function getOwner() {
     $user = $this->get('uid')->entity;
     if (!$user || $user->isAnonymous()) {
       $user = User::getAnonymousUser();
-      $user->name = $this->getAuthorName();
-      $user->homepage = $this->getHomepage();
+      $user->name->value = $this->getAuthorName();
+      $user->homepage->value = $this->getHomepage();
     }
     return $user;
   }
