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

Restart of session doesn't work #23

Closed
DavidKloucek opened this issue Nov 13, 2014 · 2 comments
Closed

Restart of session doesn't work #23

DavidKloucek opened this issue Nov 13, 2014 · 2 comments

Comments

@DavidKloucek
Copy link

@DavidKloucek DavidKloucek commented Nov 13, 2014

I need to close session before long-runing operation, because unclosed session blocks other processes.

$session->start();
//working with session..
$session->close();

//long-running operation

$session->start();
//working with session..
$session->close();

It returns "headers already sent..". Cookie should not be sends again, if I call start() more times, or not?
Sorry for my English.

@fprochazka

This comment has been minimized.

Copy link
Contributor

@fprochazka fprochazka commented Nov 13, 2014

I agree that cookie should be sent only once.

@mishak87

This comment has been minimized.

Copy link

@mishak87 mishak87 commented Nov 13, 2014

Nette\Http\Session is a singleton wrapper for PHP bugs, quirks and insecurities. start is a lazy singleton initialization and close does cleanup, they are not closed pair.

Ad-hoc fix: Don't send output to user before starting session for second time.

Solution: Create basket for data, store it in different storage (ie.: database) and its id in session. Flush headers immediately. Work... Then update basket and store it again.
I wouldn't store anything produced by long running script to session, it introduces more problems then it solves.

@dg dg closed this in 3d794c3 Mar 14, 2018
dg added a commit that referenced this issue Mar 14, 2018
dg added a commit that referenced this issue Mar 14, 2018
…hanged [Closes #134][Closes #23]
dg added a commit that referenced this issue Mar 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.