Skip to content

Commit

Permalink
For user claims, substitute invalid utf8 chars with replacement char
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Ivančić authored and pradtke committed Jan 31, 2023
1 parent 40e2ea3 commit f76e1af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Entity/UserEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function fromState(array $state): self
$user = new self();

$user->identifier = $state['id'];
$user->claims = json_decode($state['claims'], true);
$user->claims = json_decode($state['claims'], true, 512, JSON_INVALID_UTF8_SUBSTITUTE);
$user->updatedAt = TimestampGenerator::utc($state['updated_at']);
$user->createdAt = TimestampGenerator::utc($state['created_at']);

Expand All @@ -82,7 +82,7 @@ public function getState(): array
{
return [
'id' => $this->getIdentifier(),
'claims' => json_encode($this->getClaims()),
'claims' => json_encode($this->getClaims(), JSON_INVALID_UTF8_SUBSTITUTE),
'updated_at' => $this->getUpdatedAt()->format('Y-m-d H:i:s'),
'created_at' => $this->getCreatedAt()->format('Y-m-d H:i:s'),
];
Expand Down

0 comments on commit f76e1af

Please sign in to comment.