diff --git a/src/DataDog/AuditBundle/EventSubscriber/AuditSubscriber.php b/src/DataDog/AuditBundle/EventSubscriber/AuditSubscriber.php index 5a73dbe..6cbfa60 100644 --- a/src/DataDog/AuditBundle/EventSubscriber/AuditSubscriber.php +++ b/src/DataDog/AuditBundle/EventSubscriber/AuditSubscriber.php @@ -452,6 +452,16 @@ protected function label(EntityManager $em, $entity) protected function value(EntityManager $em, Type $type, $value) { + // json_encode will error when trying to encode a resource + if (is_resource($value)) { + // https://stackoverflow.com/questions/26303513/getting-blob-type-doctrine-entity-property-returns-data-only-once/26306571 + if (0 !== ftell($value)) { + rewind($value); + } + + $value = stream_get_contents($value); + } + $platform = $em->getConnection()->getDatabasePlatform(); switch ($type->getName()) { case Type::BOOLEAN: