Skip to content

Commit

Permalink
feat: Update JSON encoding to use JSON_THROW_ON_ERROR in Encrypter an…
Browse files Browse the repository at this point in the history
…d ConfigurationUrlParser (#691)

Co-authored-by: Deeka Wong <[email protected]>
  • Loading branch information
huangdijia and huangdijia authored Jul 21, 2024
1 parent baeea0f commit 402c86e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ConfigurationUrlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Hyperf\Collection\Arr;
use InvalidArgumentException;
use JsonException;

class ConfigurationUrlParser
{
Expand Down Expand Up @@ -159,10 +160,9 @@ protected function parseStringsToNativeTypes(mixed $value): mixed
return $value;
}

$parsedValue = json_decode($value, true);

if (json_last_error() === JSON_ERROR_NONE) {
return $parsedValue;
try {
return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
}

return $value;
Expand Down

0 comments on commit 402c86e

Please sign in to comment.