[PHPLIB-DEV] cvs commit From: chagenbu (phplib-dev <email protected>)
Date: 01/24/00

From: chagenbu
Date: Tue Jan 25 04:56:03 2000
Modified files:
      php-lib/php/session.inc

Log message:
(chagenbu) Modifying $sess->put_id() as suggested on the phplib listserver.
It now unsets the cookie if the session is using cookie mode, and otherwise
does nothing. This lets methods like get, which don't need to do anything
special to relinquish a session id, call $sess->delete() safely.

Index: php-lib/php/session.inc
diff -u php-lib/php/session.inc:1.57 php-lib/php/session.inc:1.58
--- php-lib/php/session.inc:1.57 Wed Dec 15 11:54:50 1999
+++ php-lib/php/session.inc Tue Jan 25 04:55:32 2000
@@ -5,7 +5,7 @@
  * Copyright (c) 1998,1999 NetUSE GmbH
  * Boris Erdmann, Kristian Koehntopp
  *
- * $Id: session.inc,v 1.57 1999/12/15 10:54:50 kir Exp $
+ * $Id: session.inc,v 1.58 2000/01/25 03:55:32 chagenbu Exp $
  *
  */
 
@@ -143,26 +143,20 @@
   ## Stop using the current session id (unset cookie, ...) and
   ## abandon a session.
   function put_id() {
- global $HTTP_COOKIE_VARS;
-
- $this->name = $this->cookiename==""?$this->classname:$this->cookiename;
-
     switch ($this->mode) {
- case "inline":
- die("This has not been coded yet.");
- break;
-
- case "get":
- die("This has not been coded yet.");
+ case "cookie":
+ global $HTTP_COOKIE_VARS;
+ $this->name = $this->cookiename == '' ? $this->classname : $this->cookiename;
+ SetCookie($this->name, '', 0, '/', $this->cookie_domain);
+ $HTTP_COOKIE_VARS[$this->name] = '';
       break;
-
+
       default:
- SetCookie($this->name, "", 0, "/", $this->cookie_domain);
- $HTTP_COOKIE_VARS[$this->name] = "";
+ // do nothing. We don't need to die for modes other than cookie here.
       break;
     }
   }
-
+
   ## delete():
   ##
   ## Delete the current session record and put the session id.

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.