Archive for December, 2008
Serialization issues with SimpleXML
I’m using PHP for my semester project @ EPFL, and I stumbled upon a curious bug when trying to serialize an object (using PHP’s serialize()):
Node no longer exists
First I thought it was because of an infinite recursive loop (object A contains object B who in turn contains object A again, and so on), but in fact, infinite recursivity is allowed with serialize()!
Therefore, the problem was elsewhere: it ended up being an issue with SimpleXML, as explained here. SimpleXML’s parser creates strange, unserializable, “built-in objects”.
Until you try to serialize them, you never realize they aren’t just strings. An explicit cast solves the problem.
// isn't serializable. $track->URI = $first_track->location; // resolves the problem! $track->URI = (string)$first_track->location;
Hello world!
Welcome on my blog.
I’m experimenting a lot of stuff on the web and with computers in general, and quite often I spend hours discovering, configuring and trying to understand some obscure geeky stuff.
I have decided to start blogging to share some informations I think could be useful to some people. I spend a lot of time on Google trying to find various tutorials, explanations, tips, and I thought it would be great to share some of that knowledge.
Don’t expect every post to be interesting: rather than a generalistic, regular blogging style, I’m willing to talk about very different, specific things in a random fashion. I expect people that come here to have a very specific and precise interest in a single topic, and eventually finding this blog through Google.