Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 22dcdfd

Browse files
Do not crash on invalid UTF-8
1 parent bada68a commit 22dcdfd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/Parser/ParserException.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use function assert;
88
use function json_encode;
99
use function sprintf;
10+
use const JSON_INVALID_UTF8_SUBSTITUTE;
1011
use const JSON_UNESCAPED_SLASHES;
1112
use const JSON_UNESCAPED_UNICODE;
1213

@@ -84,7 +85,7 @@ public function getExpectedTokenValue(): ?string
8485

8586
private function formatValue(string $value): string
8687
{
87-
$json = json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
88+
$json = json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE);
8889
assert($json !== false);
8990

9091
return $json;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /