Skip to content

Commit

Permalink
fix: json syntax error with empty string (#150)
Browse files Browse the repository at this point in the history
Co-authored-by: Mathieu De Keyzer <[email protected]>
  • Loading branch information
coppee and theus77 authored Dec 1, 2022
1 parent 2dd82e5 commit 2fdb9ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions EMS/common-bundle/src/Service/ElasticaService.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,12 @@ private function resolveElasticsearchSearchParameters(array $parameters): array
return $value;
})
->setNormalizer('body', function (Options $options, $value) {
if (null === $value || '' === $value) {
return [];
}
if (\is_string($value)) {
$value = \json_decode($value, true, 512, JSON_THROW_ON_ERROR);
}
if (null === $value) {
return [];
}

return $value;
})
Expand Down

0 comments on commit 2fdb9ed

Please sign in to comment.