[HttpClient] work around PHP 7.3 bug related to json_encode()
This commit is contained in:
parent
40076b98bf
commit
42904e34e6
@ -301,7 +301,13 @@ trait HttpClientTrait
|
||||
}
|
||||
|
||||
try {
|
||||
$value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0), $maxDepth);
|
||||
if (\PHP_VERSION_ID >= 70300) {
|
||||
// Work around https://bugs.php.net/77997
|
||||
json_encode(null);
|
||||
$flags |= JSON_THROW_ON_ERROR;
|
||||
}
|
||||
|
||||
$value = json_encode($value, $flags, $maxDepth);
|
||||
} catch (\JsonException $e) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid value for "json" option: %s.', $e->getMessage()));
|
||||
}
|
||||
|
Reference in New Issue
Block a user