fix numeric values in filter control. #665

This commit is contained in:
Andreas Gohr
2023-08-31 11:33:15 +02:00
parent b417c33516
commit da8d86ad95

View File

@ -79,7 +79,18 @@ class AggregationFilter extends Aggregation
// create an array with [value => displayValue] pairs
// the cast to array will handle single and multi-value fields the same
// using the full value as key will make sure we don't have duplicates
$pairs = array_combine((array)$value->getValue(), (array)$value->getDisplayValue());
//
// because a value might be interpreted as integer in the array key, we pad
// each key with a space at the end to enforce string keys. The space will
// be ignored when parsing JSON values and trimmed for all other types.
// This is a work around for #665
$pairs = array_combine(
array_map(
static fn($v) => "$v ",
(array)$value->getValue()
),
(array)$value->getDisplayValue()
);
$colValues[$colName]['values'] = array_merge($colValues[$colName]['values'], $pairs);
}
}