Bug #67421 [NEW]: Provide session_close function for releasing a session without affecting it
| From: | ianbytchek at gmail dot com | Date: | Wed, 11 Jun 2014 12:17:51 +0000 |
| Subject: | Bug #67421 [NEW]: Provide session_close function for releasing a session without affecting it | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-186151@lists.php.net to get a copy of this message | ||
From: ianbytchek at gmail dot com
Operating system: OS X
PHP version: 5.5.13
Package: Session related
Bug Type: Bug
Bug description:Provide session_close function for releasing a session without affecting it
Description:
------------
The language currently offers two functions (session_commint() /
session_write_close() and session_destroy()) to close an active session
and change the session status from active to none. However, currently
there is no decent way to simply close the session (so that its status
is changed from active to none) without either updating its contents or
destroying it.
Normally this would not be required, but there might be situations when
the script with an active session runs another isolated script that uses
the same session and updates it. When the second script finishes and the
first one wants to reload the session updated by the second one, there
would be no obvious way of doing that. If we had a session_close
function we could simply do:
session_close();
session_start();
My current use case comes from running Behat / Mink test suites. From
the current test script the browser simulator makes a request to the
local server, which might result in updating a session, e.g., sign in
action. After response is received by the original script I want to load
this session and make assertions. To make this work I need to either
close the session after each set of assertions or use a session write
handler with a dummy destroy / commit function. Neither solution is
bullet proof or natural.
So, I propose to include a new session_close() function, which would
simply close the session without destroying it or updating the remote
file / record.
--
Edit bug report at https://bugs.php.net/bug.php?id=67421&edit=1
--