Skip to content

Commit

Permalink
Remove JSON_THROW_ON_ERROR as it's a PHP 7.3 feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Jul 7, 2019
1 parent f83c01e commit 7de4b9b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/CachedResponse.php
Expand Up @@ -38,7 +38,10 @@ public static function fromResponse(
public static function fromCacheData(string $data): self
{
try {
$data = \json_decode($data, true, 4, \JSON_THROW_ON_ERROR);
$data = \json_decode($data, true, 4);
if ($data === null) {
throw new HttpException('Failed to decode cached data, JSON syntax error');
}

if (!isset(
$data['protocol_version'],
Expand Down Expand Up @@ -139,7 +142,7 @@ public function toCacheData(): string
'request_time' => $this->requestTime->getTimestamp(),
'response_time' => $this->responseTime->getTimestamp(),
'body_hash' => $this->bodyHash,
], \JSON_THROW_ON_ERROR);
]);
}

/**
Expand Down

0 comments on commit 7de4b9b

Please sign in to comment.