Skip to content

Session cleanup cron can delete a session that has just logged in #445

Closed

Description

@caseysoftware

w2p_System_Session::write() inserts a new session row without session_user (L78–82), so it stays 0 until the session is written again on a later request. CUser::hook_cron() (modules/users/users.class.php L232) deletes sessions where session_user = '' OR session_user IS NULL; MySQL compares 0 = '' as true, so the cron deletes every row still at 0. If it runs between a login and the user's next request, that user is logged out.

Fix: write session_user on insert as well as on update, and clean up with an explicit session_user = 0 plus an age condition, so fresh sessions aren't removed.

Blocks #458.

Fix before Phase 0 of the Identity Layer proposal (#435).

Activity

  1. added a commit that references this issue on Oct 24, 2026
    5591b79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions