problemas con session y objetos!!!!!!!!!

sebastiann
08 de Junio del 2004
Hola amigo: me tira el siguiente error php cuando trato de pasar un objeto por la session:

Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition <b>employee</b> of the object you are trying to operate on was loaded _before_ the session was started in D:Archivos de programaApache GroupApache2htdocsfinal2.php on line 5

Mis codigos son:
<?php /*Page 1*/
session_start();
/*class declaration*/
class Employee{
var $name;
var $lastname;
function newEmpl($name,$lname){
$this->name = $name;
$this->lastname = $lname;
}
function getEmpl(){
return $this->name;
}
}

$myempl = new Employee;
$myempl->newEmpl('Peter','Gabriel');
$myempl->newEmpl('Alex','Bowie');
$_SESSION['myempla'] = $myempl;
echo "<a href="2.php">go next page to test our class</a>";
?>

//pagina2
<?php session_start();
echo "<p>Testing our class</p><br >";


echo $_SESSION['myempla']->getEmpl();


?>


attel
08 de Junio del 2004
Intenta cambiar el auto start de session en php.ini
Ponlo asi: session.auto_start = 0
Eso puede solusionar el problema.