Skip to content

Commit

Permalink
Merge pull request #71 from chancegarcia/handle-resource-values
Browse files Browse the repository at this point in the history
-`json_encode` will error on resource variable values
  • Loading branch information
l3pp4rd committed Apr 3, 2020
2 parents 9012a27 + e057f22 commit 6f0e570
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/DataDog/AuditBundle/EventSubscriber/AuditSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6f0e570

Please sign in to comment.