|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47964 session_write_open request
Submitted: 2009-04-14 04:22 UTC Modified: 2013-08-10 08:24 UTC
Avg. Score:4.3 ± 0.6
Reproduced:8 of 8 (100.0%)
Same Version:3 (37.5%)
Same OS:8 (100.0%)
From: corin dot lawson at gmail dot com Assigned: yohgaki (profile)
Status: Wont fix Package: Session related
PHP Version: * OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-04-14 04:22 UTC] corin dot lawson at gmail dot com
The function session_write_close is very useful to permit concurrent page loads by releasing the lock on the session data ASAP. It would be useful to have a function to get that lock back and read session data again, namely session_write_open or session_read_write_open. (Also, session_read_only_open would be desirable for comprehensiveness.)

Currently, session_start can be used but this has the unnecessary effect of setting/sending the cookie again.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-23 21:13 UTC]
-Package: Feature/Change Request +Package: Session related
 [2011-01-23 21:13 UTC]
-Operating System: All +Operating System: * -PHP Version: 5.3.0RC1 +PHP Version: *
 [2012-03-31 03:30 UTC]
-Assigned To: +Assigned To: yohgaki
 [2012-03-31 03:30 UTC]
This issue is related to 


 [2013-08-10 08:24 UTC]
-Status: Assigned +Status: Wont fix
 [2013-08-10 08:24 UTC]
I think you are able to following with current maintained PHP. (5.4/5.5)

session_commit() // Slias of session_write_close()
session_start()  // Start session again.

If not, please open new bug report (or it may be here, so search bug db before 

I also implemented session_abort() which just ends session w/o writing. It may 
be useful to you. It available from 5.6 or later, though.
 [2015-03-26 12:36 UTC] post at bjornjohansen dot no
The issue with using session_start() to reopen a session for writing is that it resends the session cookie, even if the HTTP headers have been sent.

This means that currently, one have to use output buffering.

If something like session_write_open() existed, one would be able to write to the current session even after the HTTP headers have been sent.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Feb 25 02:01:23 2021 UTC