Skip to content

Commit f76e1af

Browse files
cicnavipradtke
authored andcommitted
For user claims, substitute invalid utf8 chars with replacement char
1 parent 40e2ea3 commit f76e1af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Entity/UserEntity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static function fromState(array $state): self
6868
$user = new self();
6969

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

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

0 commit comments

Comments
 (0)