sessionService: use a generic removeAll function to unset FORM data

Instead of manually removing entries in the SESSION object, let the
SessionService do the work in creating poll controllers.
This commit is contained in:
Paul B 2019-04-17 15:41:16 +02:00
parent 5d74a5600d
commit f0b38fdb42
No known key found for this signature in database
GPG Key ID: DE331B23748D3A27
3 changed files with 14 additions and 3 deletions

View File

@ -55,9 +55,20 @@ class SessionService {
unset($_SESSION[$section][$key]);
}
/**
* Remove a session section
*
* @param $section
*/
public function removeAll($section) {
assert(!empty($section));
unset($_SESSION[$section]);
}
private function initSectionIfNeeded($section) {
if (!isset($_SESSION[$section])) {
$_SESSION[$section] = [];
}
}
}
}

View File

@ -195,7 +195,7 @@ switch ($step) {
}
// Clean Form data in $_SESSION
unset($_SESSION['form']);
$sessionService->removeAll('form');
// Delete old polls
$purgeService->repeatedCleanings();

View File

@ -230,7 +230,7 @@ switch ($step) {
}
// Clean Form data in $_SESSION
unset($_SESSION['form']);
$sessionService->removeAll('form');
$purgeService->repeatedCleanings();