php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11308 'exit;' causes session_save_handler save routine not to run
Submitted: 2001-06-06 08:13 UTC Modified: 2001-06-08 13:04 UTC
From: jmat at shutdown dot net Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.5 OS: Linux 2.4
Private report: No CVE-ID: None
 [2001-06-06 08:13 UTC] jmat at shutdown dot net
When a custom script is used to read/write sessions, and an exit is called in the middle of a script, the session write routine never gets called -- even though when using the internal routines, it does.

This makes scripts that use Header redirects semi-useless, since they can't do 'exit;' to get out of the script as soon as the header is sent.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-06 08:47 UTC] jmat at shutdown dot net
I bypassed this problem, for now by doing a 

do {


...


} while(0);

and using 'break'; to jump out of the script.. but shouldn't the internal handler act the same as the 'user defined' handlers?  if 'exit' causes the internal-files handler to save the session, the user-defined one should run, as well... 
 [2001-06-08 13:04 UTC] sas@php.net
They get called, but you cannot output text from there.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Feb 06 13:03:40 2023 UTC