Zend_Serializer_AdapterZend_Serializer adapters create a bridge for different methods of serializing with very little effort. Every adapter has different pros and cons. In some cases, not every PHP datatype (e.g., objects) can be converted to a string representation. In most such cases, the type will be converted to a similar type that is serializable -- as an example, PHP objects will often be cast to arrays. If this fails, a Zend_Serializer_Exception will be thrown. Below is a list of available adapters. Zend_Serializer_Adapter_PhpSerializeThis adapter uses the built-in un/serialize PHP functions, and is a good default adapter choice. There are no configurable options for this adapter. Zend_Serializer_Adapter_Igbinary» Igbinary is Open Source Software released by Sulake Dynamoid Oy. It's a drop-in replacement for the standard PHP serializer. Instead of time and space consuming textual representation, igbinary stores PHP data structures in a compact binary form. Savings are significant when using memcached or similar memory based storages for serialized data. You need the igbinary PHP extension installed on your system in order to use this adapter. There adapter takes no configuration options. Zend_Serializer_Adapter_Wddx» WDDX (Web Distributed Data eXchange) is a programming-language-, platform-, and transport-neutral data interchange mechanism for passing data between different environments and different computers. The adapter simply uses the » wddx_*() PHP functions. Please read the PHP manual to determine how you may enable them in your PHP installation. Additionally, the » SimpleXML PHP extension is used to check if a returned NULL value from wddx_unserialize() is based on a serialized NULL or on invalid data. Available options include:
Zend_Serializer_Adapter_JsonThe JSON adapter provides a bridge to the Zend_Json component and/or ext/json. Please read the Zend_Json documentation for further information. Available options include:
Zend_Serializer_Adapter_Amf 0 and 3The AMF adapters, Zend_Serializer_Adapter_Amf0 and Zend_Serializer_Adapter_Amf3, provide a bridge to the serializer of the Zend_Amf component. Please read the Zend_Amf documentation for further information. There are no options for these adapters. Zend_Serializer_Adapter_PythonPickleThis adapter converts PHP types to a » Python Pickle string representation. With it, you can read the serialized data with Python and read Pickled data of Python with PHP. Available options include:
Datatype merging (PHP to Python) occurs as follows:
Datatype merging (Python to PHP) occurs per the following:
Zend_Serializer_Adapter_PhpCodeThis adapter generates a parsable PHP code representation using » var_export(). On restoring, the data will be executed using » eval. There are no configuration options for this adapter. Warning
Unserializing objectsObjects will be serialized using the » __set_state magic method. If the class doesn't implement this method, a fatal error will occur during execution. Warning
Uses eval()The PhpCode adapter utilizes eval() to unserialize. This introduces both a performance and potential security issue as a new process will be executed. Typically, you should use the PhpSerialize adapter unless you require human-readability of the serialized data.
|