Skip to content

Commit

Permalink
fix: Make sure to reopen session before cleaning
Browse files Browse the repository at this point in the history
Otherwise restoring the requesttoken would reopen and read the existing
session data and restore it instead of clearing

Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr authored and blizzz committed Mar 16, 2023
1 parent b351d7b commit cc3f61b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/private/Session/CryptoSessionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,17 @@ public function remove(string $key) {
* Reset and recreate the session
*/
public function clear() {
$reopened = $this->reopen();
$requesttoken = $this->get('requesttoken');
$this->sessionValues = [];
if ($requesttoken !== null) {
$this->set('requesttoken', $requesttoken);
}
$this->isModified = true;
$this->session->clear();
if ($reopened) {
$this->close();
}
}

public function reopen(): bool {
Expand Down

0 comments on commit cc3f61b

Please sign in to comment.