php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67421 Provide session_close function for releasing a session without affecting it
Submitted: 2014-06-11 12:17 UTC Modified: 2014-06-11 18:41 UTC
From: ianbytchek at gmail dot com Assigned: requinix (profile)
Status: Closed Package: Session related
PHP Version: 5.5.13 OS: OS X
Private report: No CVE-ID: None
 [2014-06-11 12:17 UTC] ianbytchek at gmail dot com
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.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-11 17:20 UTC] requinix@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: requinix
 [2014-06-11 17:20 UTC] requinix@php.net
Implemented in 5.6 as session_abort().
 [2014-06-11 18:41 UTC] ianbytchek at gmail dot com
Awesome! Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 23:01:30 2024 UTC