visibility + unserialization
| From: | Ted Wood | Date: | Mon, 26 May 2008 15:26:25 +0000 |
| Subject: | visibility + unserialization | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-274700@lists.php.net to get a copy of this message | ||
I have a 4 year old framework that serializes objects and stores them in the database. It is now going PHP 5-only, so I began to add visibility to the class definitions of the serialized objects. However, then things didn't work properly after objects stored [before the visibility was added] were unserialized. For example, each protected field ended up creating two fields, with one followed by ":protected".
Expected Result:
----------------------
object(Foo) {
["bar"]=>
string(0) "banana"
}
Actual Result:
----------------------
object(Foo) {
["bar:protected"]=>
string(0) ""
["bar"]=>
string(6) "banana"
}
Anybody run into this, or can explain why this might be and how I can avoid it?
Thanks,
~Ted