PHP 4.0 Bug #3974: Object properties produce unexpected results upon registering them to a session
| From: | seth at subimage dot com | Date: | Thu, 30 Mar 2000 03:55:10 +0000 |
| Subject: | PHP 4.0 Bug #3974: Object properties produce unexpected results upon registering them to a session | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17383@lists.php.net to get a copy of this message | ||
From: seth@subimage.com
Operating system: Redhat Linux 6.1
PHP version: 4.0 Release Candidate 1
PHP Bug Type: Session related
Bug description: Object properties produce unexpected results upon registering them to a session
When I create an instance of an object, register it to the session, and access it's properties
from that page, all appear fine.
After going to the next page, starting the session, and trying to read properties, they either
don't appear or come back with values from _other_ variables!!!
In this instance, sometimes I get back nothing on the second page for the variable $auth->id, but
sometimes I get the value of $user!!!
Classfile...
class Auth {
// properties
var $classname = "Auth";
var $lifetime = 0;
var $id = "";
var $md5pass = "";
var $sharedValue = "";
var $auth = false;
var $crack = "";
function Auth() {
$this->sharedValue = md5(uniqid(rand()));
}
function setcrack($crack) {
$this->crack = $crack;
}
function setid($id) {
$this->id = $id;
}
}
first page...
include("class/auth.php");
session_start();
$auth = new Auth();
$auth->setcrack("crack!");
$auth->setid("this is the auth user");
session_register("auth");
(note, the html on this page has 2 input boxes, "user" and "password")
second page...
--php--
require("class/auth.php");
session_start();
$results = $auth->validate($user, $password);
--php--
client pass: <?= $clientPassword ?>
<br>
server pass: <?= $serverPassword ?>
<br>
user id: <?= $user ?>
<br>
password: <?= $password ?>
<br>
shared value: <?= $auth->sharedValue ?>
<br>
results: <?= $results ?>
<br>
authcrack: <?= $auth->crack ?>
<br>
authuser: <?= $auth->id ?>
<br>
authauth: <? $auth->auth ?>