diff --git a/core/lib/Drupal/Core/Session/AccountProxy.php b/core/lib/Drupal/Core/Session/AccountProxy.php
index f9d0d35..5914603 100644
--- a/core/lib/Drupal/Core/Session/AccountProxy.php
+++ b/core/lib/Drupal/Core/Session/AccountProxy.php
@@ -186,5 +186,12 @@ public function getLastAccessedTime() {
     return $this->getAccount()->getLastAccessedTime();
   }
 
-}
+  /**
+   * {@inheritdoc}
+   */
+  public function __sleep() {
+    trigger_error('The account proxy was serialized.', E_USER_ERROR);
+    return array_keys(get_object_vars($this));
+  }
 
+}
