[Phplib-commit] CVS: php-lib/php/session session3.inc,1.5,1.6
Brought to you by:
nhruby,
richardarcher
|
From: Richard A. <ric...@us...> - 2001-08-18 09:47:22
|
Update of /cvsroot/phplib/php-lib/php/session
In directory usw-pr-cvs1:/tmp/cvs-serv24905
Modified Files:
session3.inc
Log Message:
Sync with -stable:
url() removes session ID from GET string before adding another (new method)
$str in serialize() changed to call by reference
change $this->in to be 0 or 1 rather than false or 1
remove empty() calls
revert ' to " to be in sync with stable - no performance penalty in PHP4
Index: session3.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib/php/session/session3.inc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** session3.inc 2001/08/18 02:45:05 1.5
--- session3.inc 2001/08/18 09:47:19 1.6
***************
*** 45,49 ****
var $pt = array(); ## This Array contains the registered things
! var $in = false; ## Marker: Did we already include the autoinit file?
## register($things):
--- 45,49 ----
var $pt = array(); ## This Array contains the registered things
! var $in = 0; ## Marker: Did we already include the autoinit file?
## register($things):
***************
*** 91,95 ****
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
! if (empty($id)) {
$newid=false;
switch ($this->mode) {
--- 91,95 ----
$this->name = $this->cookiename==""?$this->classname:$this->cookiename;
! if ( "" == $id ) {
$newid=false;
switch ($this->mode) {
***************
*** 126,138 ****
// Remove session ID info from QUERY String - it is in cookie
! if ( !empty($QUERY_STRING) )
! {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
! "", $QUERY_STRING);
}
break;
case "get":
! if ( !empty($QUERY_STRING) ) {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
--- 126,137 ----
// Remove session ID info from QUERY String - it is in cookie
! if ( isset($QUERY_STRING) && ("" != $QUERY_STRING) ) {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
! "\\1", $QUERY_STRING);
}
break;
case "get":
! if ( isset($QUERY_STRING) && ("" != $QUERY_STRING) ) {
$QUERY_STRING = ereg_replace(
"(^|&)".quotemeta(urlencode($this->name))."=".$id."(&|$)",
***************
*** 152,161 ****
## abandon a session.
function put_id() {
switch ($this->mode) {
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;
--- 151,161 ----
## abandon a session.
function put_id() {
+ global $HTTP_COOKIE_VARS;
+
switch ($this->mode) {
case "cookie":
! $this->name = $this->cookiename == "" ? $this->classname : $this->cookiename;
! SetCookie($this->name, "", 0, "/", $this->cookie_domain);
! $HTTP_COOKIE_VARS[$this->name] = "";
break;
***************
*** 181,191 ****
function url($url) {
! // Remove existing session info from url:
! if (strstr($url, $this->name) != false)
! {
! $url = ereg_replace("&*".$this->name."=[[:alnum:]]+", "", $url);
! }
! // Remove trailing ?/& if needed
$url=ereg_replace("[&?]+$", "", $url);
--- 181,190 ----
function url($url) {
! // Remove existing session info from url
! $url = ereg_replace(
! "([&?])".quotemeta(urlencode($this->name))."=".$this->id."(&|$)",
! "\\1", $url);
! // Remove trailing ?/& if needed
$url=ereg_replace("[&?]+$", "", $url);
***************
*** 210,214 ****
return $this->url($PHP_SELF.
! ((!empty($QUERY_STRING)) ? "?".$QUERY_STRING : ""));
}
--- 209,213 ----
return $this->url($PHP_SELF.
! ((isset($QUERY_STRING) && ("" != $QUERY_STRING)) ? "?".$QUERY_STRING : ""));
}
***************
*** 243,247 ****
global $QUERY_STRING;
! if ( !empty($QUERY_STRING)
|| ($this->mode == "get")) {
$sep_char = "&";
--- 242,246 ----
global $QUERY_STRING;
! if ((isset($QUERY_STRING) && ("" != $QUERY_STRING))
|| ($this->mode == "get")) {
$sep_char = "&";
***************
*** 286,290 ****
while ( "array" == $l ) {
## Structural recursion
! $this->serialize($var."['".ereg_replace("([\\'])", "\\\\1", $k)."']", $str);
eval("\$l = gettype(list(\$k)=each(\$$var));");
}
--- 285,289 ----
while ( "array" == $l ) {
## Structural recursion
! $this->serialize($var."['".ereg_replace("([\\'])", "\\\\1", $k)."']", &$str);
eval("\$l = gettype(list(\$k)=each(\$$var));");
}
***************
*** 302,306 ****
reset($'.$var.');
while ( list($k) = each($'.$var.') ) {
! $this->serialize( "${var}->".$k, $str );
}
}
--- 301,305 ----
reset($'.$var.');
while ( list($k) = each($'.$var.') ) {
! $this->serialize( "${var}->".$k, &$str );
}
}
***************
*** 429,434 ****
// no cookie and no GET/POST params
- header("Status: 302 Moved Temporarily");
-
// Generate session ID and setup cookie.
$this->get_id($sid);
--- 428,431 ----
***************
*** 444,447 ****
--- 441,445 ----
$PROTOCOL='http';
}
+ header("Status: 302 Moved Temporarily");
header("Location: ". $PROTOCOL. "://".$HTTP_HOST.$this->self_url());
exit;
|