diff --git a/Storage/Service/EntityStorage.php b/Storage/Service/EntityStorage.php
index <HASH>..<HASH> 100644
--- a/Storage/Service/EntityStorage.php
+++ b/Storage/Service/EntityStorage.php
@@ -242,7 +242,7 @@ class EntityStorage implements StorageInterface
         $entity = $this->repository->findByHash($hash, $context, false);
         if ($entity) {
             $entity->setConfirmed(true);
-            $entity->setSize(strlen($entity->getContents()));
+            $entity->setSize(strlen((string) $entity->getContents()));
             $this->manager->persist($entity);
             $this->manager->flush();
             return true;
bug(param-type): explicit cast resource to string for strlen