diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
index c7f4275..61481af 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
@@ -338,6 +338,10 @@ public function __sleep() {
     $this->fields = array();
     $this->fieldDefinitions = NULL;
     $this->clearTranslationCache();
+
+    // Don't serialize the url generator.
+    $this->urlGenerator = NULL;
+
     return array_keys(get_object_vars($this));
   }
 
diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php
index 714aeeb..573d2d8 100644
--- a/core/lib/Drupal/Core/Entity/Entity.php
+++ b/core/lib/Drupal/Core/Entity/Entity.php
@@ -394,4 +394,14 @@ protected function urlGenerator() {
     return $this->urlGenerator;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function __sleep() {
+    // Don't serialize the url generator.
+    $this->urlGenerator = NULL;
+
+    return array_keys(get_object_vars($this));
+  }
+
 }
diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php
index 6fde86c..322d18a 100644
--- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php
+++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php
@@ -31,6 +31,13 @@ class CommentFormController extends ContentEntityFormController {
   protected $fieldInfo;
 
   /**
+   * The current user.
+   *
+   * @var \Drupal\Core\Session\AccountInterface
+   */
+  protected $currentUser;
+
+  /**
    * {@inheritdoc}
    */
   public static function create(ContainerInterface $container) {
