php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #20421 session_abort() and session_reset()
Submitted: 2002-11-14 03:19 UTC Modified: 2013-08-10 07:58 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: ernest at vogelsinger dot at Assigned: yohgaki
Status: Closed Package: Session related
PHP Version: * OS: *
Private report: No CVE-ID:
 [2002-11-14 03:19 UTC] ernest at vogelsinger dot at
What happens to a session when a script gets aborted? I don't believe there can be a one-shot solution for all situations, and I can easily imagine that one would want to keep the session data, but doesn't want to save anything changed _just_now_ (similar to a transaction rollback).

A function session_abort() or session_reset() could do just this - abort any open session without modifying the session storage. Having such methods one could decide in a registered shutdown function how to proceed.

session_abort()
Works similar to session_write_close() except that it doesn't store session data

session_reset()
Rereads the $_SESSION superglobal from stored session data, destroying any modifications so far. The session remains open.

Thanks for consideration (possibly in 4.3?),
Ernest

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-29 17:44 UTC] jani@php.net
-Package: Feature/Change Request +Package: Session related -Operating System: any +Operating System: * -PHP Version: 4.2.2 +PHP Version: *
 [2012-03-31 03:39 UTC] yohgaki@php.net
-Assigned To: +Assigned To: yohgaki
 [2013-08-10 07:32 UTC] yohgaki@php.net
-Summary: Would come handy: session_abort() +Summary: session_abort() and session_reset()
 [2013-08-10 07:58 UTC] yohgaki@php.net
-Status: Assigned +Status: Closed
 [2013-08-10 07:58 UTC] yohgaki@php.net
These functions are available 5.6 or later.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC