Hi!
I'm having trouble with storing objects with attributes that are objects in the session. The sub-objects simply disappear. However, it works perfectly on php 4.0.0.
does anybody know a newer version on which it does work??
here's an example that works on 4.0.0 and not on 4.0.3pl1:
===start code===
<?
class category{
var $test;
var $subcategories;
var $value;
function category($val){
$this->value = $val;
echo "new category made ".$this->value."<br>";
}
function passvalue(){
echo $this->value."<br>";
}
function makesubcat(){
if(!$this->subcategories[0] and !$this->subcategories[1]){
$this->subcategories = array();
$this->subcategories[0] = new category(4);
$this->subcategories[1] = new category(5);
}
}
}
session_start();
if(!session_is_registered('deletecat')){
session_register('deletecat');
}
if($off){
session_destroy();
session_start();
session_register("deletecat");
$deletecat = new category(1);
$deletecat->makesubcat();
}
?>
<form method="post" action="test.php">
<input type="submit" name="off" value="logoff">
</form>
<?
$deletecat->passvalue();
echo "number of subs: ".sizeof($deletecat->subcategories)."<br>";
$deletecat->subcategories[0]->passvalue();
$deletecat->subcategories[1]->passvalue();
?>
<form method="post" action="test.php">
<input type="submit" value="OK">
</form>
=======end code========