News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pavel Shevaev's Blog:
A reliable way to serialize/unserialize objects in PHP
December 11, 2007 @ 12:09:00

Pavel Shevaev has posted his method (a reliable way) for serializing and unserializing objects in your applications:

An experienced PHP developer might be wondering why posting this topic in a blog if PHP already has universal and almost transparent tools for this job [...] The key statement here is "almost transparent" which means you have to include all class definitions before invoking unserialize or use some __autoload schema.

The whole problem is due to the fact a serialized object has no idea about its class definition except the class name(the reason behind that is absolutely valid). [...] That's why I decided to hack up, hopefully, a more universal solution to this problem

His method contains things inside of a "serialization container" that automagically includes everything needed before it gets serialized. His code for the method is included as well as some examples of its use.

0 comments voice your opinion now!
serialize unserialize object container method serialize unserialize object container method


blog comments powered by Disqus

Similar Posts

Ian Selby's Blog: Dynamically Add Functions to PHP Classes

DevShed: More Examples of Creating Command Objects with PHP 5

Juan Treminio: Unit Testing Tutorial Part V: Mock Methods and Overriding Constructors

Elated.com: Object-Oriented PHP: Autoloading, Serializing, and Querying Objects

Gonzalo Ayuso: How to configure Symfony’s Service Container to use Twitter API


Community Events











Don't see your event here?
Let us know!


example install performance composer database hhvm podcast package component release symfony2 introduction facebook security unittest language application project hack framework

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework