Skip to content

SessionInternal::clear() erroneously calls start_session() when session is still open #31248

@rotdrop

Description

@rotdrop

SessionInternal::clear() does strange things:

public function clear() {
$this->invoke('session_unset');
$this->regenerateId();
$this->startSession(true);
$_SESSION = [];
}

Error: session_start(): Ignoring session_start() because a session is already active at /var/www/localhost/htdocs/nextcloud-git/lib/private/Session/Internal.php#208 
  1. session_unset() -- ok, destroys all values
  2. regenerateId() -- ok, generate a new session id
  3. start_session() -- oops. But the session is still open.

So either the start_session is superfluous and can be omitted -- at least in current versions of php -- or there is missing something like a session_destroy() (but then regenerate_id() could be omitted?) or a session_write_close() which would write the (now empty) session file to disk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap25-feedbackbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions