Welcome Guest, Not a member yet? Register   Sign In
Serialize / Unserialize object array
#1

[eluser]Unknown[/eluser]
Hi everybody,

I’m new in the forum and I have the following problem. I have a function which retrieves an array of serialized objects and which later I pass place into the session userdata. The problem comes when I try to unserialize each object and use any of the function defined at the object class. When make a var_dump of one of the unserialized object I get the following result.

object(__PHP_Incomplete_Class)#20 (6) {
["__PHP_Incomplete_Class_Name"]=>
string(5) "Clase"
["id":"Clase":private]=>
string(1) "1"
["nombre":"Clase":private]=>
string(13) "Comp"
["codigo":"Clase":private]=>
string(5) "C"
["periodo":"Clase":private]=>
string(19) "Otono"
}

The strange thing is that I tried retrieving the array of the serialized objects from the session user data at the same controller just after I set them into the session user data, and when I execute a var_dump of one of the unserialized object and I don’t get the PHP_Incomplete_Class message.

What can I be doing wrong? Thanks in advance.

Regards
#2

[eluser]theprodigy[/eluser]
Take a look at this PHP page.

Quote:In order to be able to unserialize() an object, the class of that object needs to be defined. That is, if you have an object of class A and serialize this, you'll get a string that refers to class A and contains all values of variables contained in it. If you want to be able to unserialize this in another file, an object of class A, the definition of class A must be present in that file first.




Theme © iAndrew 2016 - Forum software by © MyBB