php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2228 Session environment not restored automatically at start of script as per docs
Submitted: 1999-09-03 00:50 UTC Modified: 1999-09-03 10:23 UTC
From: kmunn at munn dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Beta 2 OS: Red Hat Linux 6.0 on Intel
Private report: No CVE-ID: None
 [1999-09-03 00:50 UTC] kmunn at munn dot com
My configuration file says...

   session.save_handler = files
   session.save_path = /tmp
   session.name = PHPSESSID
   session.auto_start = 1
   session.lifetime = 0
   session.serialize_handler = php
   session.gc_probability = 1
   session.gc_maxlifetime = 1440

But when I register a session variable and set the value, the session variables are not automatically
set at the beginning of the next page I hit.  However, if I add a call to session_register with *one* of the
variable names, *all* the session variables are set in the environment.  Workaround is to put one of those
session_register calls in every page (yuck) which is what I'm doing in the meantime.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-09-03 10:02 UTC] andrey at cvs dot php dot net
This is happening because your auto_start is set to 1, which means that
the session mechanism is started automagically when you session_register()
any variable. Another way of doing it is to call session_start() manually.
Just put this in your auto_prepend file and forget about it.
 [1999-09-03 10:23 UTC] kmunn at munn dot com
The documentation reads...

session.auto_start specifies whether the session module 
     start a session automatically on request startup.

What you're explaining doesn't sound automatic to me, it
sounds like I have to call a function on every page to get
the session environment (either register or start).  If
auto_start = 0 in my config, I have to call session_start 
to begin a session and then session_start on every page
to get the environment?  So basically the only thing
auto_start buys me is one less command to "start" the 
session?

Much more useful would be if, with auto_start = 1, the
session variables were set on entry to the page.  With
auto_start = 0, it could require a call to the session
functions to initialize.

- Kristofer

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 16:01:31 2024 UTC