I was looking through the WordPress core, and I found this function:
function unserialize ( $data ) {
return unserialize( $data );
}
First off, I don’t even understand why unserialize has been defined since its a native php function. Secondly, what in the world is going on here since its defined recursively without any condition to halt infinite recursion?
Throw me a bone. I’m newbie at this stuff.
That’s got to be method definition in a class, eg:
Otherwise you’d get a fatal error saying that you can’t redeclare
unserialize().All it does is add an
unserialize()method to a class. This method then calls the nativeunserialize()function in PHP. Seems rather silly, but then, I didn’t write WordPress.I believe I found the method in question:
wp-includes/rss.php(line 783). And it’s indeed a method of theRSSCacheclass.I suppose it’s possible they might want to write their own serialization routine in the future and/or some subclass of
RSSCachehas its ownserialize()andunserialize().