diff --git a/lib/Service/ColumnTypes/SelectionBusiness.php b/lib/Service/ColumnTypes/SelectionBusiness.php index 2b01427963..3fd6f19c76 100644 --- a/lib/Service/ColumnTypes/SelectionBusiness.php +++ b/lib/Service/ColumnTypes/SelectionBusiness.php @@ -24,7 +24,7 @@ public function parseValue($value, Column $column): string { foreach ($column->getSelectionOptionsArray() as $option) { if ($option['id'] === $intValue) { - return json_encode($option['id']); + return json_encode((string)$option['id']); } } diff --git a/tests/unit/Service/ColumnTypes/SelectionBusinessTest.php b/tests/unit/Service/ColumnTypes/SelectionBusinessTest.php index 59c34df5b8..babf703852 100644 --- a/tests/unit/Service/ColumnTypes/SelectionBusinessTest.php +++ b/tests/unit/Service/ColumnTypes/SelectionBusinessTest.php @@ -33,9 +33,9 @@ public function setUp(): void { public function parseValueProvider(): array { return [ - 'valid integer value' => [2, '2'], - 'valid string value' => ['2', '2'], - 'valid string value for numeric option' => ['4', '4'], + 'valid integer value' => [2, '"2"'], + 'valid string value' => ['2', '"2"'], + 'valid string value for numeric option' => ['4', '"4"'], 'invalid value' => [5, ''], 'null value' => [null, ''], 'empty string' => ['', ''],