mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Export: ListPerson: avoid json_decoding the string '_header'
This commit is contained in:
parent
5f441eb5ac
commit
4727a57825
5
.changes/unreleased/Fixed-20231127-210138.yaml
Normal file
5
.changes/unreleased/Fixed-20231127-210138.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: 'Export: fix list person with custom fields'
|
||||||
|
time: 2023-11-27T21:01:38.260730706+01:00
|
||||||
|
custom:
|
||||||
|
Issue: ""
|
@ -332,7 +332,6 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
|
|||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR);
|
|
||||||
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
$label = $cfType->getChoices($cf)[$slugChoice];
|
$label = $cfType->getChoices($cf)[$slugChoice];
|
||||||
@ -341,6 +340,12 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
|
|||||||
.' | '.$label;
|
.' | '.$label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR);
|
||||||
|
} catch (\JsonException $e) {
|
||||||
|
throw new \RuntimeException(sprintf('unable to decode json: %s, %s', json_last_error(), json_last_error_msg()), $e->getCode(), $e);
|
||||||
|
}
|
||||||
|
|
||||||
if ('_other' === $slugChoice && $cfType->isChecked($cf, $slugChoice, $decoded)) {
|
if ('_other' === $slugChoice && $cfType->isChecked($cf, $slugChoice, $decoded)) {
|
||||||
return $cfType->extractOtherValue($cf, $decoded);
|
return $cfType->extractOtherValue($cf, $decoded);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user