[development] RE : unserialize

fgm fgm at osinet.fr
Tue Dec 1 22:23:44 UTC 2009


More generally, if you want to serialize objects that don't have plain content, for instances objects containing resources, you need to implement __sleep and __serialize to provide (un)serialize with a means to store what information you want to serialize, because it has no way to get to it on its own. 

See http://fr2.php.net/manual/fr/language.oop5.magic.php#language.oop5.magic.sleep

This is basically what you work around by converting to XML text: you removed the hidden info, just like a _sleep implementation would do.

________________________________________
De : development-bounces at drupal.org [development-bounces at drupal.org] de la part de Randy Fay [randy at randyfay.com]
Date d'envoi : mardi 1 décembre 2009 20:49
À : development at drupal.org
Objet : Re: [development] unserialize

Your google approach was correct: http://drupal.org/node/529866 has a good rundown on this.

I've also had major serialization issues with simplexml. In that case you have to store XML into the cache after converting to xml using simplexml's methodology - you can't just dump a tree into the drupal cache.

-Randy

On Tue, Dec 1, 2009 at 2:42 PM, Jeff Greenberg <jeff at ayendesigns.com<mailto:jeff at ayendesigns.com>> wrote:
I asked about this at #drupal-support, and am waiting for an answer, but when I Googled it (+unserialize +"Error at offset" +"bootstrap.inc") I received 220,000 postings, so maybe this is a big issue I missed?  Unserialize error at offset x of y bytes in boostrap.inc?




--
Randy Fay
Drupal Development, troubleshooting, and debugging
randy at randyfay.com<mailto:randy at randyfay.com>
+1  970.462.7450



More information about the development mailing list