Test Foro de elhacker.net SMF 2.1

Programación => Desarrollo Web => PHP => Mensaje iniciado por: kosis157 en 5 Marzo 2009, 22:15 PM

Título: error en el acceso a la propiedad
Publicado por: kosis157 en 5 Marzo 2009, 22:15 PM
Estoy haciendo una web he creado una clase login si se valida bien guardo la clase en la session con los datos correctos, luego al recuperar los datos me tira un error, el error es este:
CitarFatal error: main() [<a href='function.main'>function.main</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;Login&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in C:\Documents and Settings\Administrador\Mis documentos\wwwroot\web\Index.php on line 33

y la linea 33 es:
Código (php) [Seleccionar]

if(isset($_SESSION['login'])){
   $logins=$_SESSION['login'];
   echo $logins->getId();(linea 33)
}

y la función getId es:
Código (php) [Seleccionar]

public function getId(){
   return $this->id;
}



gracias por la ayuda ::)
Título: Re: error en el acceso a la propiedad
Publicado por: alone-in-the-chat en 6 Marzo 2009, 21:22 PM
Usualmente sucede al manejar objetos y tratar de mantenerlos en la sesion , prueba incluyendo las clases antes de llamar al session_start().


Código (php) [Seleccionar]


include("miclase.inc.php");
session_start();




Saludos¡¡
Título: Re: error en el acceso a la propiedad
Publicado por: OzX en 8 Marzo 2009, 19:32 PM

Citarof the object you are trying to operate on was loaded _before_ unserialize()

Iniciaste la Clase?
new Class.. etc?