Introducción a Zend Framework

 Aprendiendo Zend Framework

Apéndice

 Referencia de Zend Framework


  • Zend_Gdata
  • Zend_Http
  • Zend_InfoCard
  • Zend_Json
  • Zend_Layout
  • Zend_Ldap
  • Zend_Loader
  • Zend_Locale
  • Zend_Log
  • Zend_Mail
  • Zend_Markup
  • Zend_Measure
  • Zend_Memory
  • Zend_Mime
  • Zend_Navigation
  • Zend_Oauth
  • Zend_OpenId
  • Zend_Paginator
  • Zend_Pdf
  • Zend_ProgressBar
  • Zend_Queue
  • Zend_Reflection
  • Zend_Registry
  • Zend_Rest

  • Zend_Search_Lucene
  • Zend_Serializer
  • Zend_Server
  • Zend_Service
  • Zend_Session
  • Zend_Soap
  • Zend_Tag
  • Zend_Test
  • Zend_Text
  • Zend_TimeSync
  • Zend_Tool
  • Zend_Tool_Framework
  • Zend_Tool_Project
  • Zend_Translate
  • Zend_Uri
  • Zend_Validate
  • Zend_Version
  • Zend_View
  • Zend_Wildfire
  • Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Traducción al 26.9% - Actualizado el 2011-11-16 - Revisión 24249 - Versión ZF 1.11.x

    61.2. Zend_Serializer_Adapter

    Zend_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.

    61.2.1. Zend_Serializer_Adapter_PhpSerialize

    This adapter uses the built-in un/serialize PHP functions, and is a good default adapter choice.

    There are no configurable options for this adapter.

    61.2.2. 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.

    61.2.3. 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:

    Tabla 61.1. Zend_Serializer_Adapter_Wddx Options

    Option Data Type Default Value Description
    comment string   An optional comment that appears in the packet header.

    61.2.4. Zend_Serializer_Adapter_Json

    The 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:

    Tabla 61.2. Zend_Serializer_Adapter_Json Options

    Option Data Type Default Value Description
    cycleCheck boolean false See this section
    objectDecodeType Zend_Json::TYPE_* Zend_Json::TYPE_ARRAY See this section
    enableJsonExprFinder boolean false See this section

    61.2.5. Zend_Serializer_Adapter_Amf 0 and 3

    The 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.

    61.2.6. Zend_Serializer_Adapter_PythonPickle

    This 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:

    Tabla 61.3. Zend_Serializer_Adapter_PythonPickle Options

    Option Data Type Default Value Description
    protocol integer (0 | 1 | 2 | 3) 0 The Pickle protocol version used on serialize

    Datatype merging (PHP to Python) occurs as follows:

    Tabla 61.4. Datatype merging (PHP to Python)

    PHP Type Python Type
    NULL None
    boolean boolean
    integer integer
    float float
    string string
    array list
    associative array dictionary
    object dictionary

    Datatype merging (Python to PHP) occurs per the following:

    Tabla 61.5. Datatype merging (Python to PHP)

    Python-Type PHP-Type
    None NULL
    boolean boolean
    integer integer
    long integer | float | string | Zend_Serializer_Exception
    float float
    string string
    bytes string
    Unicode string UTF-8 string
    list array
    tuple array
    dictionary associative array
    All other types Zend_Serializer_Exception

    61.2.7. Zend_Serializer_Adapter_PhpCode

    This 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.

    [Aviso] Unserializing objects

    Objects will be serialized using the __set_state magic method. If the class doesn't implement this method, a fatal error will occur during execution.

    [Aviso] 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.

    digg delicious meneame google twitter technorati facebook

    Comentarios

    Loading...