Skip to content

Commit

Permalink
Strengthen type checking in AuditTrait (#228)
Browse files Browse the repository at this point in the history
* Strengthen type checking in AuditTrait

Fixes #227

* PHP-CS-Fixer

---------

Co-authored-by: Damien Harper <[email protected]>
  • Loading branch information
janklan and DamienHarper authored Oct 31, 2024
1 parent 9e81de0 commit 8077b2d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Provider/Doctrine/Auditing/Transaction/AuditTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ private function diff(EntityManagerInterface $entityManager, object $entity, arr
}

if ($o !== $n) {
if (isset($type) && Type::getType(Types::JSON) === $type) {
if (
isset($type) && Type::getType(Types::JSON) === $type
&& (null === $o || \is_array($o)) && (null === $n || \is_array($n))
) {
/**
* @var ?array $o
* @var ?array $n
Expand Down

0 comments on commit 8077b2d

Please sign in to comment.