8000 minor #59203 [JsonEncoder] Reuse decodeString in NativeDecoder (alami… · symfony/symfony@d57efd1 · GitHub
[go: up one dir, main page]

Skip to content

Commit d57efd1

Browse files
committed
minor #59203 [JsonEncoder] Reuse decodeString in NativeDecoder (alamirault)
This PR was merged into the 7.3 branch. Discussion ---------- [JsonEncoder] Reuse decodeString in NativeDecoder | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT Commits ------- 0e83e1e [JsonEncoder] Use reuse decodeString in NativeDecoder
2 parents aa23093 + 0e83e1e commit d57efd1

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/Symfony/Component/JsonEncoder/Decode/NativeDecoder.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ public static function decodeStream($stream, int $offset = 0, ?int $length = nul
4040
$json = $stream->read($length);
4141
}
4242

43-
try {
44-
return json_decode($json, associative: true, flags: \JSON_THROW_ON_ERROR);
45-
} catch (\JsonException $e) {
46-
throw new UnexpectedValueException('JSON is not valid: '.$e->getMessage());
47-
}
43+
return self::decodeString($json);
4844
}
4945
}

0 commit comments

Comments
 (0)
0