Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple session start calls #36239

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/Command/App/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
}
}
else $output->writeln($appId . ' no new version available');
}
$output->writeln('Update command processed');

return $return;
}
Expand Down
18 changes: 11 additions & 7 deletions lib/private/Session/Internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ public function remove(string $key) {
}

public function clear() {
$this->reopen();
$this->invoke('session_unset');
$this->regenerateId();
$this->invoke('session_unset');
$this->invoke('session_write_close');
$this->startSession(true);
$_SESSION = [];
Expand Down Expand Up @@ -179,9 +178,7 @@ public function getId(): string {
*/
public function reopen(): bool {
if ($this->sessionClosed) {
$this->startSession(false, false);
$this->sessionClosed = false;
return true;
return $this->startSession(false);
}

return false;
Expand Down Expand Up @@ -217,11 +214,18 @@ private function invoke(string $functionName, array $parameters = [], bool $sile
}
}

private function startSession(bool $silence = false, bool $readAndClose = true) {
/**
* @return bool
*/
private function startSession(bool $readAndClose = true) {
$sessionParams = ['cookie_samesite' => 'Lax'];
if (\OC::hasSessionRelaxedExpiry()) {
$sessionParams['read_and_close'] = $readAndClose;
}
$this->invoke('session_start', [$sessionParams], $silence);
if ($this->invoke('session_start', [$sessionParams])) {
$this->sessionClosed = !empty($sessionParams['read_and_close']);
the-djmaze marked this conversation as resolved.
Show resolved Hide resolved
return true;
}
return false;
}
}