Sipefree Posted March 13, 2006 Share Posted March 13, 2006 Hello-I'm having problems unserializing an array. Each key in the array contains an object that is instantiated from a class.When I unserialize the string, it creates all the objects, but does weird stuff to the names of variables. The class itself is a Preference class, for storing different types of preference values, and it has properties such as QXPref::value and QXPref::kind, etc. However, when the array is unserialized, somehow these values become null, even though I can see them in the serialized string. When I used var_dump() and print_r() to show the values, it showed that the original 'value' and 'kind' properties were null, but new ones, 'value:private' and 'kind:private' contained the values that the old ones were supposed to have.Here's a snippet from the print_r():[code]Array( [com.qunix.core.allowGuestMode] => QXPref Object ( [value] => [kind] => [pro] => 0 [value:private] => 1 [kind:private] => bool [pro:private] => 0 )[/code](The 'pro' property is a boolean of the preference's protected status within the web application, and not the object).This behavior seems very strange and I cannot find any mention of it on the PHP.net manual (mainly because search engines cannot handle ":private").The properties are marked as public in the class definition, so I've no idea why it's doing this.Anyone got any clues? I moved my preferences system from an XML definition to a serialized array, and this problem is preventing my web application from starting up, so I can't work on anything until I find the source of this problem. Quote Link to comment https://forums.phpfreaks.com/topic/4838-problems-unserializing-an-array-of-objects/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.