Skip to content

Commit ac8e600

Browse files
committed
Fix storing empty config arrays
Closes: #2855 Closes: #2472
1 parent da2dbec commit ac8e600

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

webapp/src/Controller/Jury/ConfigController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ public function indexAction(EventLogService $eventLogService, Request $request):
6666
}
6767
}
6868
$before = $this->config->all();
69+
// In case we clear a value it would not be sent and we keep the old value, this is a mistake
70+
foreach ($before as $key => $value) {
71+
if (!isset($data[$key])) {
72+
if (is_array($value)) {
73+
$data[$key] = [];
74+
} else {
75+
$data[$key] = null;
76+
}
77+
}
78+
}
6979
$errors = $this->config->saveChanges($data, $eventLogService, $this->dj, options: $options);
7080
$after = $this->config->all();
7181

0 commit comments

Comments
 (0)