-
Notifications
You must be signed in to change notification settings - Fork 979
Closed
Milestone
Description
Summary of problem or feature request
Above PHP 7.3 the Json error handling in the SmartSerializer has a bug which creates another exception. Instead of the JSON erorr code the error message is passed to the JsonErrorException constructor.
Code snippet of problem
if (version_compare(PHP_VERSION, '7.3.0') >= 0) {
try {
$result = json_decode($data, true, 512, JSON_THROW_ON_ERROR);
return $result;
} catch (\JsonException $e) {
$result = $result ?? [];
throw new JsonErrorException($e->getMessage(), $data, $result);
}
}
Possible patch would be:
- throw new JsonErrorException($e->getMessage(), $data, $result);
+ throw new JsonErrorException($e->getCode(), $data, $result);
System details
- Operating System: all
- PHP Version: above 7.3
- ES-PHP client version: 7.6.1
- Elasticsearch version: all
Metadata
Metadata
Assignees
Labels
No labels