Skip to content
Open
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: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 2.1.1 under development

- no changes in this release.
- Bug #61: Reset session between requests in long-running applications (@viktorprogger, @roxblnfk)

## 2.1.0 May 02, 2024

Expand Down
2 changes: 2 additions & 0 deletions src/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public function open(): void

if ($this->sessionId !== null) {
session_id($this->sessionId);
} else {
session_id(session_create_id());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about collision check? session_create_id don't check collision if called before start session.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. In symfony it's not check. May be to make custom session ID creating optional? Use boolean flag or callback or create SessionIdGeneratorInterface?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be very non-intuitive for users

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be very non-intuitive for users

Then we must find solutions without collision risk. Otherwise we fix bug for longliving apps, but add new problem with collisions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this?

session_start($this->options);
$this->sessionId = session_create_id();
session_write_close();
session_id($this->sessionId);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this?

session_start($this->options);
$this->sessionId = session_create_id();
session_write_close();
session_id($this->sessionId);

This will entail additional costs on read/write session data.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra opening a session doesn't sound good to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

try {
Expand Down