Skip to content

Commit

Permalink
Validate that diff is a string before passing to mb_convert_encoding (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnboers authored Feb 22, 2023
1 parent 563146c commit 7729f4c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ private function audit(array $data): void
$schema = $data['schema'] ? $data['schema'].'.' : '';
$auditTable = $schema.$configuration->getTablePrefix().$data['table'].$configuration->getTableSuffix();
$dt = new DateTimeImmutable('now', new DateTimeZone($this->provider->getAuditor()->getConfiguration()->getTimezone()));
$diff = is_string($data["diff"]) ? mb_convert_encoding($data['diff'], 'UTF-8', 'UTF-8') : $data["diff"];

$payload = [
'entity' => $data['entity'],
Expand All @@ -219,7 +220,7 @@ private function audit(array $data): void
'object_id' => (string) $data['id'],
'discriminator' => $data['discriminator'],
'transaction_hash' => (string) $data['transaction_hash'],
'diffs' => json_encode(mb_convert_encoding($data['diff'], 'UTF-8', 'UTF-8'), JSON_THROW_ON_ERROR),
'diffs' => json_encode($diff, JSON_THROW_ON_ERROR),
'blame_id' => $data['blame']['user_id'],
'blame_user' => $data['blame']['username'],
'blame_user_fqdn' => $data['blame']['user_fqdn'],
Expand Down

0 comments on commit 7729f4c

Please sign in to comment.