| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect1 id="zend.serializer.adapter">
- <title>Zend_Serializer_Adapter</title>
- <para>
- <classname>Zend_Serializer</classname> adapters create a bridge for different methods of
- serializing with very little effort.
- </para>
- <para>
- Every adapter has different pros and cons. In some cases, not every <acronym>PHP</acronym>
- 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,
- <acronym>PHP</acronym> objects will often be cast to arrays. If this fails, a
- <classname>Zend_Serializer_Exception</classname> will be thrown.
- </para>
- <para>
- Below is a list of available adapters.
- </para>
- <sect2 id="zend.serializer.adapter.phpserialize">
- <title>Zend_Serializer_Adapter_PhpSerialize</title>
- <para>
- This adapter uses the built-in <methodname>un/serialize</methodname>
- <acronym>PHP</acronym> functions, and is a good default adapter choice.
- </para>
- <para>
- There are no configurable options for this adapter.
- </para>
- </sect2>
- <sect2 id="zend.serializer.adapter.igbinary">
- <title>Zend_Serializer_Adapter_Igbinary</title>
- <para>
- <ulink url="http://opensource.dynamoid.com">Igbinary</ulink> is Open Source Software
- released by Sulake Dynamoid Oy. It's a drop-in replacement for the standard
- <acronym>PHP</acronym> serializer. Instead of time and space consuming textual
- representation, igbinary stores <acronym>PHP</acronym> data structures in a compact
- binary form. Savings are significant when using memcached or similar memory based
- storages for serialized data.
- </para>
- <para>
- You need the igbinary <acronym>PHP</acronym> extension installed on your system in order
- to use this adapter.
- </para>
- <para>
- There adapter takes no configuration options.
- </para>
- </sect2>
- <sect2 id="zend.serializer.adapter.wddx">
- <title>Zend_Serializer_Adapter_Wddx</title>
- <para>
- <ulink url="http://wikipedia.org/wiki/WDDX">WDDX</ulink> (Web Distributed Data eXchange)
- is a programming-language-, platform-, and transport-neutral data interchange mechanism
- for passing data between different environments and different computers.
- </para>
- <para>
- The adapter simply uses the <ulink
- url="http://php.net/manual/book.wddx.php">wddx_*()</ulink> <acronym>PHP</acronym>
- functions. Please read the <acronym>PHP</acronym> manual to determine how you may enable
- them in your <acronym>PHP</acronym> installation.
- </para>
- <para>
- Additionally, the <ulink
- url="http://php.net/manual/book.simplexml.php">SimpleXML</ulink>
- <acronym>PHP</acronym> extension is used to check if a returned
- <constant>NULL</constant> value from <methodname>wddx_unserialize()</methodname> is
- based on a serialized <constant>NULL</constant> or on invalid data.
- </para>
- <para>
- Available options include:
- </para>
- <table id="zend.serializer.adapter.wddx.table.options">
- <title>Zend_Serializer_Adapter_Wddx Options</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>Option</entry>
- <entry>Data Type</entry>
- <entry>Default Value</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><emphasis>comment</emphasis></entry>
- <entry><type>string</type></entry>
- <entry></entry>
- <entry>An optional comment that appears in the packet header.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
- <sect2 id="zend.serializer.adapter.json">
- <title>Zend_Serializer_Adapter_Json</title>
- <para>
- The <acronym>JSON</acronym> adapter provides a bridge to the
- <classname>Zend_Json</classname> component and/or ext/json. Please read the <link
- linkend= "zend.json.introduction">Zend_Json documentation</link> for further
- information.
- </para>
- <para>
- Available options include:
- </para>
- <table id="zend.serializer.adapter.json.table.options">
- <title>Zend_Serializer_Adapter_Json Options</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>Option</entry>
- <entry>Data Type</entry>
- <entry>Default Value</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><emphasis>cycleCheck</emphasis></entry>
- <entry><type>boolean</type></entry>
- <entry>false</entry>
- <entry>
- See <link linkend="zend.json.advanced.objects1">this section</link>
- </entry>
- </row>
- <row>
- <entry><emphasis>objectDecodeType</emphasis></entry>
- <entry><type>Zend_Json::TYPE_*</type></entry>
- <entry>Zend_Json::TYPE_ARRAY</entry>
- <entry>
- See <link linkend= "zend.json.advanced.objects1">this section</link>
- </entry>
- </row>
- <row>
- <entry><emphasis>enableJsonExprFinder</emphasis></entry>
- <entry><type>boolean</type></entry>
- <entry>false</entry>
- <entry>
- See <link linkend= "zend.json.advanced.expr">this section</link>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
- <sect2 id="zend.serializer.adapter.amf03">
- <title>Zend_Serializer_Adapter_Amf 0 and 3</title>
- <para>
- The <acronym>AMF</acronym> adapters, <classname>Zend_Serializer_Adapter_Amf0</classname>
- and <classname>Zend_Serializer_Adapter_Amf3</classname>, provide a bridge to the
- serializer of the <classname>Zend_Amf</classname> component. Please read the <link
- linkend= "zend.amf.introduction">Zend_Amf documentation</link> for further
- information.
- </para>
- <para>
- There are no options for these adapters.
- </para>
- </sect2>
- <sect2 id="zend.serializer.adapter.pythonpickle">
- <title>Zend_Serializer_Adapter_PythonPickle</title>
- <para>
- This adapter converts <acronym>PHP</acronym> types to a <ulink
- url="http://docs.python.org/library/pickle.html">Python Pickle</ulink> string
- representation. With it, you can read the serialized data with Python and read Pickled
- data of Python with <acronym>PHP</acronym>.
- </para>
- <para>
- Available options include:
- </para>
- <table id="zend.serializer.adapter.pythonpickle.table.options">
- <title>Zend_Serializer_Adapter_PythonPickle Options</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>Option</entry>
- <entry>Data Type</entry>
- <entry>Default Value</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><emphasis>protocol</emphasis></entry>
- <entry><type>integer</type> (0 | 1 | 2 | 3)</entry>
- <entry>0</entry>
- <entry>
- The Pickle protocol version used on
- <methodname>serialize</methodname>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- Datatype merging (PHP to Python) occurs as follows:
- </para>
- <table id="zend.serializer.adapter.pythonpickle.table.php2python">
- <title>Datatype merging (PHP to Python)</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>PHP Type</entry>
- <entry>Python Type</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><type>NULL</type></entry>
- <entry><type>None</type></entry>
- </row>
- <row>
- <entry><type>boolean</type></entry>
- <entry><type>boolean</type></entry>
- </row>
- <row>
- <entry><type>integer</type></entry>
- <entry><type>integer</type></entry>
- </row>
- <row>
- <entry><type>float</type></entry>
- <entry><type>float</type></entry>
- </row>
- <row>
- <entry><type>string</type></entry>
- <entry><type>string</type></entry>
- </row>
- <row>
- <entry><type>array</type></entry>
- <entry><type>list</type></entry>
- </row>
- <row>
- <entry><type>associative array</type></entry>
- <entry><type>dictionary</type></entry>
- </row>
- <row>
- <entry><type>object</type></entry>
- <entry><type>dictionary</type></entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- Datatype merging (Python to <acronym>PHP</acronym>) occurs per the following:
- </para>
- <table id="zend.serializer.adapter.pythonpickle.table.python2php">
- <title>Datatype merging (Python to PHP)</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Python-Type</entry>
- <entry>PHP-Type</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><type>None</type></entry>
- <entry><type>NULL</type></entry>
- </row>
- <row>
- <entry><type>boolean</type></entry>
- <entry><type>boolean</type></entry>
- </row>
- <row>
- <entry><type>integer</type></entry>
- <entry><type>integer</type></entry>
- </row>
- <row>
- <entry><type>long</type></entry>
- <entry>
- <type>integer</type> | <type>float</type> | <type>string</type>
- | <classname>Zend_Serializer_Exception</classname>
- </entry>
- </row>
- <row>
- <entry><type>float</type></entry>
- <entry><type>float</type></entry>
- </row>
- <row>
- <entry><type>string</type></entry>
- <entry><type>string</type></entry>
- </row>
- <row>
- <entry><type>bytes</type></entry>
- <entry><type>string</type></entry>
- </row>
- <row>
- <entry><type>Unicode string</type></entry>
- <entry><type>UTF-8 string</type></entry>
- </row>
- <row>
- <entry><type>list</type></entry>
- <entry><type>array</type></entry>
- </row>
- <row>
- <entry><type>tuple</type></entry>
- <entry><type>array</type></entry>
- </row>
- <row>
- <entry><type>dictionary</type></entry>
- <entry><type>associative array</type></entry>
- </row>
- <row>
- <entry>All other types</entry>
- <entry><classname>Zend_Serializer_Exception</classname></entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
- <sect2 id="zend.serializer.adapter.phpcode">
- <title>Zend_Serializer_Adapter_PhpCode</title>
- <para>
- This adapter generates a parsable <acronym>PHP</acronym> code representation using
- <ulink url="http://php.net/manual/function.var-export.php">var_export()</ulink>. On
- restoring, the data will be executed using <ulink
- url="http://php.net/manual/function.eval.php">eval</ulink>.
- </para>
- <para>
- There are no configuration options for this adapter.
- </para>
- <warning>
- <title>Unserializing objects</title>
- <para>
- Objects will be serialized using the <ulink
- url="http://php.net/manual/language.oop5.magic.php#language.oop5.magic.set-state">__set_state</ulink>
- magic method. If the class doesn't implement this method, a fatal error will occur
- during execution.
- </para>
- </warning>
- <warning>
- <title>Uses eval()</title>
- <para>
- The <classname>PhpCode</classname> adapter utilizes <methodname>eval()</methodname>
- to unserialize. This introduces both a performance and potential security issue as a
- new process will be executed. Typically, you should use the
- <methodname>PhpSerialize</methodname> adapter unless you require human-readability
- of the serialized data.
- </para>
- </warning>
- </sect2>
- </sect1>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|