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 = nullnullDetails- Type
- bool

bool $_isPhp6 = nullnullDetails- 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()) : voidConstructor
| Name | Type | Description |
|---|---|---|
| $opts | array | \Zend_Config | Serializer options |

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

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

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

_hex2Utf8( $hex) : stringConvert 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) : booleanIs an array associative?
| Name | Type | Description |
|---|---|---|
| $value | array |
| Type | Description |
|---|---|
| boolean |

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

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

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

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

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

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

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

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

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

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

_read(mixed $len) : stringRead 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() : stringRead a line of the pickle at once
| Type | Description |
|---|---|
| string |
| Exception | Description |
|---|---|
| \Zend_Serializer_Exception | if no EOL character found |

_searchMomo(mixed $value) : int | falseSearch 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) : stringUnquote/Unescape a quoted string
| Name | Type | Description |
|---|---|---|
| $str | string | quoted string |
| Type | Description |
|---|---|
| string | unquoted string |

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

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

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

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

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

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

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

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

serialize(mixed $value, array $opts = array()) : stringSerialize 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_PythonPickleSet an option
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $value | mixed |
| Type | Description |
|---|---|
| \Zend_Serializer_Adapter_PythonPickle |

setOptions(array | \Zend_Config $opts) : \Zend_Serializer_Adapter_AdapterAbstractSet 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()) : mixedUnserialize 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 |