#106747Site Settings of type stringlist not saved by Settings Editor
Description
*Description:*
When attempting to save site settings of type stringlist via the Settings Editor in the TYPO3 backend, the values are not stored. This occurs because the validation logic expects an array, while the input provided is a JSON-encoded string. As a result, the data is considered invalid and the save process is aborted.
- Define a site setting of type
stringlist. - Open the Settings Editor in the TYPO3 backend.
- Input a list of strings (e.g.,
["foo", "bar"]) as a JSON-encoded string. - Save the settings.
- Observe that the values are not saved.
*Expected Behavior:*
The Settings Editor should accept a valid JSON string for stringlist types, decode it, and save it as an array.
*Actual Behavior:*
The JSON-encoded string fails validation because an array is expected directly.
*Possible Fix:*
Update the validation logic to detect if the provided value is a JSON-encoded string and convert it to an array before validation. This could be implemented similar to the existing logic in the transformValue function.
public function validate(mixed $value, SettingDefinition $definition): bool
{
// Check if given value is a json-encoded string
if (is_string($value)) {
// A json-encoded stringlist only needs 2-levels
$depth = 2;
try {
$value = json_decode($value, false, 2, JSON_THROW_ON_ERROR);
} catch (\JsonException) {
return false;
}
}
if (!is_array($value)) {
return false;
}
return $this->doValidate(new StringType($this->logger), $value, $definition);
}Reviews 2
History 37
-
Gerrit Code Review pushed patch set 1 for main to change 89517 status
NewUnder Review 05/23/25, 11:45 -
Garvin Hicking commented and changed priority
Should haveMust have 05/23/25, 11:46 -
Gerrit Code Review pushed patch set 2 for main to change 89517 05/23/25, 12:03
-
Gerrit Code Review pushed patch set 3 for main to change 89517 05/23/25, 12:21
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 89555 05/27/25, 06:06
-
Garvin Hicking commented and changed status
Under ReviewResolved done0 %100 % 05/27/25, 06:35Applied in changeset commit:dbc6dae4de85ede66b129df16eb6dfbe6c2328a1.
-
Benni Mack changed status
ResolvedClosed 12/02/25, 13:59
Thanks for the report, I was able to reproduce this and tried to implement your patch suggestion. Can you have a look if that works for you? I tried to streamline the method to avoid redundancy.