fix empty selection

This commit is contained in:
Jean-Christian Paul Denis 2023-08-20 13:20:53 +02:00
parent 2b6ee4cbba
commit 40fccc7434
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -60,7 +60,9 @@ class Config extends Process
// write settings // write settings
foreach ($s->dump() as $key => $value) { foreach ($s->dump() as $key => $value) {
if (is_bool($value)) { if (is_array($value) && empty($_POST[My::id() . $key])) {
$s->set($key, []);
} elseif (is_bool($value)) {
$s->set($key, !empty($_POST[My::id() . $key])); $s->set($key, !empty($_POST[My::id() . $key]));
} else { } else {
$s->set($key, $_POST[My::id() . $key] ?: $value); $s->set($key, $_POST[My::id() . $key] ?: $value);