Serializer/Adapter/PythonPickle.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Serializer
- Subpackage
- Adapter
- Version
- $Id: PythonPickle.php 24815 2012-05-24 08:50:24Z mabe $
\Zend_Serializer_Adapter_PythonPickle
- Parent(s)
- \Zend_Serializer_Adapter_AdapterAbstract
- See
- \global\Phython3.1/Lib/pickle.py
- See
- \global\Phython3.1/Modules/_pickle.c
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Link
- http://www.python.org
- Link
- http://pickle-js.googlecode.com
Constants
Properties


bool $_isLittleEndian = null
null
Details- Type
- bool


bool $_isPhp6 = null
null
Details- Type
- bool


array $_options = array('protocol' => 0)
Serializer options
array('protocol' => 0)
Details- Type
- array


array $_quoteString = array('\\' => '\\\\', "\x00" => '\\x00', "\x01" => '\\x01', "\x02" => '\\x02', "\x03" => '\\x03', "\x04" => '\\x04', "\x05" => '\\x05', "\x06" => '\\x06', "\x07" => '\\x07', "\x08" => '\\x08', "\x09" => '\\t', "\x0a" => '\\n', "\x0b" => '\\x0b', "\x0c" => '\\x0c', "\x0d" => '\\r', "\x0e" => '\\x0e', "\x0f" => '\\x0f', "\x10" => '\\x10', "\x11" => '\\x11', "\x12" => '\\x12', "\x13" => '\\x13', "\x14" => '\\x14', "\x15" => '\\x15', "\x16" => '\\x16', "\x17" => '\\x17', "\x18" => '\\x18', "\x19" => '\\x19', "\x1a" => '\\x1a', "\x1b" => '\\x1b', "\x1c" => '\\x1c', "\x1d" => '\\x1d', "\x1e" => '\\x1e', "\x1f" => '\\x1f', "\xff" => '\\xff')
array('\\' => '\\\\', "\x00" => '\\x00', "\x01" => '\\x01', "\x02" => '\\x02', "\x03" => '\\x03', "\x04" => '\\x04', "\x05" => '\\x05', "\x06" => '\\x06', "\x07" => '\\x07', "\x08" => '\\x08', "\x09" => '\\t', "\x0a" => '\\n', "\x0b" => '\\x0b', "\x0c" => '\\x0c', "\x0d" => '\\r', "\x0e" => '\\x0e', "\x0f" => '\\x0f', "\x10" => '\\x10', "\x11" => '\\x11', "\x12" => '\\x12', "\x13" => '\\x13', "\x14" => '\\x14', "\x15" => '\\x15', "\x16" => '\\x16', "\x17" => '\\x17', "\x18" => '\\x18', "\x19" => '\\x19', "\x1a" => '\\x1a', "\x1b" => '\\x1b', "\x1c" => '\\x1c', "\x1d" => '\\x1d', "\x1e" => '\\x1e', "\x1f" => '\\x1f', "\xff" => '\\xff')
Details- Type
- array
Methods


__construct(array | \Zend_Config $opts = array()) : void
Constructor
Name | Type | Description |
---|---|---|
$opts | array | \Zend_Config | Serializer options |


_checkProtocolNumber(int $number) : int
Check and normalize pickle protocol number
Name | Type | Description |
---|---|---|
$number | int |
Type | Description |
---|---|
int |
Exception | Description |
---|---|
\Zend_Serializer_Exception |


_convertMatchingUnicodeSequence2Utf8(array $match) : string
Convert a unicode sequence to UTF-8
Name | Type | Description |
---|---|---|
$match | array |
Type | Description |
---|---|
string |


_decodeBinLong(string $data) : int | float | string
Decode a binary long sequence
Name | Type | Description |
---|---|---|
$data | string |
Type | Description |
---|---|
int | float | string |


_hex2Utf8( $hex) : string
Convert a hex string to a UTF-8 string
Name | Type | Description |
---|---|---|
$hex |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Serializer_Exception | on unmatched unicode sequence |


_isArrayAssoc(array $value) : boolean
Is an array associative?
Name | Type | Description |
---|---|---|
$value | array |
Type | Description |
---|---|
boolean |


_load(string $op) : void
Load a pickle opcode
Name | Type | Description |
---|---|---|
$op | string |
Exception | Description |
---|---|
\Zend_Serializer_Exception | on invalid opcode |


_loadBinGet() : void
Load a binary GET operation
Exception | Description |
---|---|
\Zend_Serializer_Exception | on missing GET identifier |


_loadBinPut() : void
Load a binary PUT
Exception | Description |
---|---|
\Zend_Serializer_Exception | on missing stack |


_loadGet() : void
Load a GET operation
Exception | Description |
---|---|
\Zend_Serializer_Exception | on missing GET identifier |


_loadLongBinGet() : void
Load a long binary GET operation
Exception | Description |
---|---|
\Zend_Serializer_Exception | on missing GET identifier |


_loadLongBinPut() : void
Load a long binary PUT
Exception | Description |
---|---|
\Zend_Serializer_Exception | on missing stack |


_loadProto() : void
Load a proto value
Exception | Description |
---|---|
\Zend_Serializer_Exception | if Pickle version does not support this feature |


_loadPut() : void
Load a PUT opcode
Exception | Description |
---|---|
\Zend_Serializer_Exception | on missing stack |


_momorize(mixed $value) : void
Add a value to the memo and write the id
Name | Type | Description |
---|---|---|
$value | mixed |


_quoteString(string $str) : string
Quote/Escape a string
Name | Type | Description |
---|---|---|
$str | string |
Type | Description |
---|---|
string | quoted string |


_read(mixed $len) : string
Read a segment of the pickle
Name | Type | Description |
---|---|---|
$len | mixed |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Serializer_Exception | if position matches end of data |


_readline() : string
Read a line of the pickle at once
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Serializer_Exception | if no EOL character found |


_searchMomo(mixed $value) : int | false
Search a value in the meno and return the id
Name | Type | Description |
---|---|---|
$value | mixed |
Type | Description |
---|---|
int | false | The id or false |


_unquoteString(string $str) : string
Unquote/Unescape a quoted string
Name | Type | Description |
---|---|---|
$str | string | quoted string |
Type | Description |
---|---|
string | unquoted string |


_write(mixed $value) : void
Write a value
Name | Type | Description |
---|---|---|
$value | mixed |
Exception | Description |
---|---|
\Zend_Serializer_Exception | on invalid or unrecognized value type |


_writeArrayDict(array $value) : void
Write an associative array value as dictionary
Name | Type | Description |
---|---|---|
$value | array |


_writeArrayList(array $value) : void
Write a simple array value as list
Name | Type | Description |
---|---|---|
$value | array |


_writeObject(object $value) : void
Write an object as an dictionary
Name | Type | Description |
---|---|---|
$value | object |


_writeProto(int $protocol) : void
Write pickle protocol
Name | Type | Description |
---|---|---|
$protocol | int |


_writeString(string $value) : void
Write a string value
Name | Type | Description |
---|---|---|
$value | string |


getOption(string $name) : mixed
Get a serializer option
Inherited from: \Zend_Serializer_Adapter_AdapterAbstract::getOption()Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
mixed |
Exception | Description |
---|---|
\Zend_Serializer_Exception |


getOptions() : array
Get serializer options
Inherited from: \Zend_Serializer_Adapter_AdapterAbstract::getOptions()Type | Description |
---|---|
array |


serialize(mixed $value, array $opts = array()) : string
Serialize PHP to PythonPickle format
Name | Type | Description |
---|---|---|
$value | mixed | |
$opts | array |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Serializer_Exception |


setOption(string $name, mixed $value) : \Zend_Serializer_Adapter_PythonPickle
Set an option
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
\Zend_Serializer_Adapter_PythonPickle |


setOptions(array | \Zend_Config $opts) : \Zend_Serializer_Adapter_AdapterAbstract
Set serializer options
Inherited from: \Zend_Serializer_Adapter_AdapterAbstract::setOptions()Name | Type | Description |
---|---|---|
$opts | array | \Zend_Config | Serializer options |
Type | Description |
---|---|
\Zend_Serializer_Adapter_AdapterAbstract |


unserialize(string $pickle, array $opts = array()) : mixed
Unserialize from Python Pickle format to PHP
Name | Type | Description |
---|---|---|
$pickle | string | |
$opts | array |
Type | Description |
---|---|
mixed |
Exception | Description |
---|---|
\Zend_Serializer_Exception | on invalid Pickle string |