Index: Classes/Persistence/Generic/LazyObjectStorage.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- Classes/Persistence/Generic/LazyObjectStorage.php	(revision 3fbab8a4df174d137f68d02cbc9ac517ee07581f)
+++ Classes/Persistence/Generic/LazyObjectStorage.php	(date 1607441887518)
@@ -121,6 +121,8 @@
      */
     protected function initialize()
     {
+        $this->initializeObject();
+
         if (!$this->isInitialized) {
             $this->isInitialized = true;
             $objects = $this->dataMapper->fetchRelated($this->parentObject, $this->propertyName, $this->fieldValue, false);
@@ -186,6 +188,8 @@
      */
     public function count()
     {
+        $this->initializeObject();
+
         $columnMap = $this->dataMapper->getDataMap(get_class($this->parentObject))->getColumnMap($this->propertyName);
         $numberOfElements = null;
         if (!$this->isInitialized && $columnMap->getTypeOfRelation() === Mapper\ColumnMap::RELATION_HAS_MANY) {
@@ -340,4 +344,26 @@
         $this->initialize();
         return parent::getPosition($object);
     }
+
+    /**
+     * @inheritDoc
+     */
+    public function __sleep(): array
+    {
+        unset($this->storage);
+        unset($this->dataMapper);
+        $this->isInitialized = false;
+
+        return  ['parentObject', 'propertyName', 'fieldValue', 'isInitialized'];
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function __wakeup()
+    {
+        $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
+        $this->initializeObject();
+        $this->isInitialized = false;
+    }
 }
Index: Classes/Mvc/Controller/Argument.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- Classes/Mvc/Controller/Argument.php	(revision 3fbab8a4df174d137f68d02cbc9ac517ee07581f)
+++ Classes/Mvc/Controller/Argument.php	(date 1607428763223)
@@ -345,4 +345,23 @@
         $this->hasBeenValidated = true;
         return $this->validationResults;
     }
+
+    /**
+     * @inheritDoc
+     */
+    public function __sleep(): array
+    {
+        $properties = get_object_vars($this);
+        // avoid serialization if the site object
+        unset($properties['propertyMapper']);
+        return array_keys($properties);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function __wakeup()
+    {
+        $this->propertyMapper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Property\PropertyMapper::class);
+    }
 }
