note 39470 deleted from ref.session by didou
| From: | didou@php.net | Date: | Thu, 29 Jan 2004 17:50:12 +0000 |
| Subject: | note 39470 deleted from ref.session by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64389@lists.php.net to get a copy of this message | ||
Note Submitter: php-comment-NOSPAM-2004@ryandesign.com
----
Oh, how I wish I had read this sentence on this page before wasting hours today:
"The keys in the $_SESSION associative array are subject to the same limitations as regular
variable names in PHP, i.e. they cannot start with a number [...]"
So, don't do <?php $_SESSION[0] = "whatever"; ?> and expect
"whatever" to be available on the next page.
Also to expand on what "christophe" mentioned on 18. Dec 2003 about garbage collection, in
fact garbage collection occurs (100 * session.gc_probability / session.gc_divisor) percent of the
time a visitor calls up a page which uses sessions. By default, this is once every 100 page
requests, on average. If you wanted garbage collection to occur once every 1000 requests, you'd
keep gc_probability at 1 and set gc_divisor to 1000.
What remains unclear to me is the definition of session.gc_maxlifetime. Is a session considered
"garbage" when the current time is this many seconds after the session was created, or
this many seconds after it was last accessed?