Re: PHP 4.0 Bug #3793 Updated: session.gc_maxlifetime does not work

From: Date: Thu, 02 Nov 2000 09:04:28 +0000
Subject: Re: PHP 4.0 Bug #3793 Updated: session.gc_maxlifetime does not work
Groups: php.dev 
Request: Send a blank email to php-dev+get-36754@lists.php.net to get a copy of this message
From: "Daniel Beulshausen" <daniel@php4win.de> To: <php-dev@lists.php.net>, <kori_mail@hotmail.com> Subject: Re: [PHP-DEV] PHP 4.0 Bug #3793 Updated: session.gc_maxlifetime does not work Date: Tue, 31 Oct 2000 23:35:06 +0100
Open bugs: 1) "session.gc_maxlifetime" does not work - I set this to 60 sec, but I can read values from the session even this time was expired. (I start the session and then I wait more than 60 sec before I will call other script) this is probably a misunderstanding. after session.gc_maxliftime the session data is seen as garbage and with the session.gc_probability at each startup the data will be deleted. so if you set maxlifetime to 60, and gc_probability to 1, the session data after 60 seconds is seen as garbage and with the chance of 1% it's deleted by the actual request. sounds not like a bug to me, anyone?
OK, you are right, the session file may not be deleted, but data (values) should been deleted (destroyed), or not?. But I can read this values for example two days (if I use the same SID). I thought it works like in ASP. After xx minutes values in session expires and a new session is created. Please read the next comment...
2) When I set "session.gc_probability = 100" in PHP.INI, ALL other session files are deleted (only one session can be used at the time - if are connected 2 clients to server, the second client owerwrites or deletes session of the first client, etc.). This bug is maybe related to "session.gc_maxlifetime" bug. seems like you're having the maxlifetime alot to low, set it to 600 (for ten minutes, should be valuable) thus it's seen as garbage, because you set the probability to 100% the cleanup of garbage is performed at each startup. sounds not like a bug to me too.
Ok, I set gc.maxlife to 600, but session.gc_probability = 100 still deletes session data which are not seen as garbage also (Time of some session files < 10 minutes). I think, It's not good, because I can use only ONE session at the time. There is some bug in gc.maxlife, I think. I wrote this script which I use as temporary solution: PHP.INI settings: gc_probability = 1; //must be set to 1 - if is set to 100, I cannot use session with more than 1 connected user. ----- <?php function StartSession(){ global $param1,$session_time; session_register("param1"); session_register("session_time"); $param1 = 0; //for example, if param1 = 0, user is not logged to app, if = 1 user is looged in.
      	}
session_name("uid"); session_start(); if(!session_is_registered("param1") || $session_time < (time() - 1200)){ // if does not exist session - new session is created or if time of the session < 20 minutes, all session data is set to its default values. For exmple, user is after 20 mins of inactivity automatically logged out from application - he must log in again whith his user name and password StartSession();
       	}
$session_time = time(); //every time when user call the script, session time si set to actual time. ?> With this script which I include to all scripts that use session, session management works like in ASP. I hope you will understand what I mean... Regards, -- Kori PS: Sorry for my bad English. _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.

« previous php.dev (#36754) next »