[HttpClient] revert bad logic around JSON_THROW_ON_ERROR
This commit is contained in:
parent
d90dd8da98
commit
846116edab
@ -301,13 +301,7 @@ trait HttpClientTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (\PHP_VERSION_ID >= 70300) {
|
$value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0), $maxDepth);
|
||||||
// Work around https://bugs.php.net/77997
|
|
||||||
json_encode(null);
|
|
||||||
$flags |= JSON_THROW_ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
$value = json_encode($value, $flags, $maxDepth);
|
|
||||||
} catch (\JsonException $e) {
|
} catch (\JsonException $e) {
|
||||||
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', $e->getMessage()));
|
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ trait ResponseTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$content = json_decode($content, true, 512, JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0));
|
$content = json_decode($content, true, 512, JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0));
|
||||||
} catch (\JsonException $e) {
|
} catch (\JsonException $e) {
|
||||||
throw new JsonException($e->getMessage(), $e->getCode());
|
throw new JsonException($e->getMessage(), $e->getCode());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user