API Documentation

Zend/Serializer/Adapter/PythonPickle.php

Show: inherited
Table of Contents

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 license@zend.com 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 24816 2012-05-24 08:58:32Z mabe $  

\Zend_Serializer_Adapter_PythonPickle

Package: Zend\Serializer\Adapter

Parent(s)
\Zend_Serializer_Adapter_AdapterAbstract
See
\Phython3.1/Lib/pickle.py  
See
\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

Constant  OP_MARK = '('
Constant  OP_STOP = '.'
Constant  OP_POP = '0'
Constant  OP_POP_MARK = '1'
Constant  OP_DUP = '2'
Constant  OP_FLOAT = 'F'
Constant  OP_INT = 'I'
Constant  OP_BININT = 'J'
Constant  OP_BININT1 = 'K'
Constant  OP_LONG = 'L'
Constant  OP_BININT2 = 'M'
Constant  OP_NONE = 'N'
Constant  OP_PERSID = 'P'
Constant  OP_BINPERSID = 'Q'
Constant  OP_REDUCE = 'R'
Constant  OP_STRING = 'S'
Constant  OP_BINSTRING = 'T'
Constant  OP_SHORT_BINSTRING = 'U'
Constant  OP_UNICODE = 'V'
Constant  OP_BINUNICODE = 'X'
Constant  OP_APPEND = 'a'
Constant  OP_BUILD = 'b'
Constant  OP_GLOBAL = 'c'
Constant  OP_DICT = 'd'
Constant  OP_EMPTY_DICT = '}'
Constant  OP_APPENDS = 'e'
Constant  OP_GET = 'g'
Constant  OP_BINGET = 'h'
Constant  OP_INST = 'i'
Constant  OP_LONG_BINGET = 'j'
Constant  OP_LIST = 'l'
Constant  OP_EMPTY_LIST = ']'
Constant  OP_OBJ = 'o'
Constant  OP_PUT = 'p'
Constant  OP_BINPUT = 'q'
Constant  OP_LONG_BINPUT = 'r'
Constant  OP_SETITEM = 's'
Constant  OP_TUPLE = 't'
Constant  OP_EMPTY_TUPLE = ')'
Constant  OP_SETITEMS = 'u'
Constant  OP_BINFLOAT = 'G'
Constant  OP_PROTO = "\x80"
Constant  OP_NEWOBJ = "\x81"
Constant  OP_EXT1 = "\x82"
Constant  OP_EXT2 = "\x83"
Constant  OP_EXT4 = "\x84"
Constant  OP_TUPLE1 = "\x85"
Constant  OP_TUPLE2 = "\x86"
Constant  OP_TUPLE3 = "\x87"
Constant  OP_NEWTRUE = "\x88"
Constant  OP_NEWFALSE = "\x89"
Constant  OP_LONG1 = "\x8a"
Constant  OP_LONG4 = "\x8b"
Constant  OP_BINBYTES = 'B'
Constant  OP_SHORT_BINBYTES = 'C'

Properties

Propertyprotected  $_binary= 'false'
Default valuefalseDetails
Type
Propertyprotectedbool  $_isLittleEndian= 'null'
static

Whether or not the system is little-endian
Default valuenullDetails
Type
bool
Propertyprotectedbool  $_isPhp6= 'null'
static

Whether or not this is a PHP 6 binary
Default valuenullDetails
Type
bool
Propertyprotected  $_marker= 'null'
Default valuenullDetails
Type
Propertyprotected  $_memo= 'array()'
Default valuearray()Details
Type
Propertyprotectedarray  $_options= 'array( 'protocol' => 0'

Default options
Default valuearray( 'protocol' => 0Details
Type
array
Propertyprotected  $_pickle= ''''
Default value''Details
Type
Propertyprotected  $_pickleLen= '0'
Default value0Details
Type
Propertyprotected  $_pos= '0'
Default value0Details
Type
Propertyprotected  $_protocol= '0'
Default value0Details
Type
Propertyprotectedarray  $_quoteString= 'array( '\\' => '\\\\''
static

Strings representing quotes
Default valuearray( '\\' => '\\\\'Details
Type
array
Propertyprotected  $_stack= 'array()'
Default valuearray()Details
Type

Methods

methodpublic__construct(  $opts = array() ) : void

Constructor

Parameters
Name Type Description
$opts
Details
Link
Zend_Serializer_Adapter_AdapterAbstract::__construct()  
methodprotected_checkProtocolNumber( int $number ) : int

Check and normalize pickle protocol number

Parameters
Name Type Description
$number int
Returns
Type Description
int
Throws
Exception Description
\Zend_Serializer_Exception
methodprotected_convertMatchingUnicodeSequence2Utf8( array $match ) : string

Convert a unicode sequence to UTF-8

Parameters
Name Type Description
$match array
Returns
Type Description
string
methodprotected_decodeBinLong( string $data ) : int|float|string

Decode a binary long sequence

Parameters
Name Type Description
$data string
Returns
Type Description
int|float|string
methodprotected_hex2Utf8(  $hex ) : string

Convert a hex string to a UTF-8 string

Parameters
Name Type Description
$hex
Returns
Type Description
string
Throws
Exception Description
\Zend_Serializer_Exception on unmatched unicode sequence
methodprotected_isArrayAssoc( array $value ) : boolean

Is an array associative?

Parameters
Name Type Description
$value array
Returns
Type Description
boolean
methodprotected_lastMarker( ) : int

Return last marker position in stack

Returns
Type Description
int
methodprotected_load( string $op ) : void

Load a pickle opcode

Parameters
Name Type Description
$op string
Throws
Exception Description
\Zend_Serializer_Exception on invalid opcode
methodprotected_loadAppend( ) : void

Load an append (to list) sequence

methodprotected_loadAppends( ) : void

Load multiple append (to list) sequences at once

methodprotected_loadBinBytes( ) : void

Load arbitrary binary bytes

methodprotected_loadBinFloat( ) : void

Load a binary float value

methodprotected_loadBinGet( ) : void

Load a binary GET operation

Throws
Exception Description
\Zend_Serializer_Exception on missing GET identifier
methodprotected_loadBinInt( ) : void

Load a binary integer operator

methodprotected_loadBinInt1( ) : void

Load the first byte of a binary integer

methodprotected_loadBinInt2( ) : void

Load the second byte of a binary integer

methodprotected_loadBinPut( ) : void

Load a binary PUT

Throws
Exception Description
\Zend_Serializer_Exception on missing stack
methodprotected_loadBinString( ) : void

Load a binary string

methodprotected_loadBinUnicode( ) : void

Load binary unicode sequence

methodprotected_loadDict( ) : void

Load an associative array (Python dictionary)

methodprotected_loadEmptyDict( ) : void

Load an empty dictionary

methodprotected_loadEmptyList( ) : void

Load an empty list sequence

methodprotected_loadFloat( ) : void

Load a float value

methodprotected_loadGet( ) : void

Load a GET operation

Throws
Exception Description
\Zend_Serializer_Exception on missing GET identifier
methodprotected_loadInt( ) : void

Load an integer operator

methodprotected_loadList( ) : void

Load an array (list)

methodprotected_loadLong( ) : void

Load a long (float) operator

methodprotected_loadLong1( ) : void

Load a one byte long integer

methodprotected_loadLong4( ) : void

Load a 4 byte long integer

methodprotected_loadLongBinGet( ) : void

Load a long binary GET operation

Throws
Exception Description
\Zend_Serializer_Exception on missing GET identifier
methodprotected_loadLongBinPut( ) : void

Load a long binary PUT

Throws
Exception Description
\Zend_Serializer_Exception on missing stack
methodprotected_loadMark( ) : void

Load a marker sequence

methodprotected_loadNewFalse( ) : void

Load a boolean FALSE operator

methodprotected_loadNewTrue( ) : void

Load a boolean TRUE operator

methodprotected_loadNone( ) : void

Load a NONE operator

methodprotected_loadProto( ) : void

Load a proto value

Throws
Exception Description
\Zend_Serializer_Exception if Pickle version does not support this feature
methodprotected_loadPut( ) : void

Load a PUT opcode

Throws
Exception Description
\Zend_Serializer_Exception on missing stack
methodprotected_loadSetItem( ) : void

Load an item from a set

methodprotected_loadSetItems( ) : void

Load set items

methodprotected_loadShortBinBytes( ) : void

Load a single binary byte

methodprotected_loadShortBinString( ) : void

Load a short binary string

methodprotected_loadString( ) : void

Load a string

methodprotected_loadTuple( ) : void

Load a tuple

methodprotected_loadTuple1( ) : void

Load single item tuple

methodprotected_loadTuple2( ) : void

Load two item tuple

methodprotected_loadTuple3( ) : void

Load three item tuple

methodprotected_loadUnicode( ) : void

Load a unicode string

methodprotected_momorize( mixed $value ) : void

Add a value to the memo and write the id

Parameters
Name Type Description
$value mixed
methodprotected_quoteString( string $str ) : string

Quote/Escape a string

Parameters
Name Type Description
$str string
Returns
Type Description
string quoted string
methodprotected_read( mixed $len ) : string

Read a segment of the pickle

Parameters
Name Type Description
$len mixed
Returns
Type Description
string
Throws
Exception Description
\Zend_Serializer_Exception if position matches end of data
methodprotected_readline( ) : string

Read a line of the pickle at once

Returns
Type Description
string
Throws
Exception Description
\Zend_Serializer_Exception if no EOL character found
methodprotected_searchMomo( mixed $value ) : int|false

Search a value in the meno and return the id

Parameters
Name Type Description
$value mixed
Returns
Type Description
int|false The id or false
methodprotected_unquoteString( string $str ) : string

Unquote/Unescape a quoted string

Parameters
Name Type Description
$str string

quoted string

Returns
Type Description
string unquoted string
methodprotected_write( mixed $value ) : void

Write a value

Parameters
Name Type Description
$value mixed
Throws
Exception Description
\Zend_Serializer_Exception on invalid or unrecognized value type
methodprotected_writeArrayDict( array $value ) : void

Write an associative array value as dictionary

Parameters
Name Type Description
$value array
methodprotected_writeArrayList( array $value ) : void

Write a simple array value as list

Parameters
Name Type Description
$value array
methodprotected_writeFalse( ) : void

Write a boolean false

methodprotected_writeFloat( float $value ) : void

Write a float value

Parameters
Name Type Description
$value float
methodprotected_writeGet( int $id ) : void

Write a get

Parameters
Name Type Description
$id int

Id of memo

methodprotected_writeInt( int $value ) : void

Write an integer value

Parameters
Name Type Description
$value int
methodprotected_writeNull( ) : void

Write a null as None

methodprotected_writeObject( object $value ) : void

Write an object as an dictionary

Parameters
Name Type Description
$value object
methodprotected_writeProto( int $protocol ) : void

Write pickle protocol

Parameters
Name Type Description
$protocol int
methodprotected_writePut( int $id ) : void

Write a put

Parameters
Name Type Description
$id int

Id of memo

methodprotected_writeStop( ) : void

Write stop

methodprotected_writeString( string $value ) : void

Write a string value

Parameters
Name Type Description
$value string
methodprotected_writeTrue( ) : void

Write a boolean true

methodpublicserialize( mixed $value, array $opts = array() ) : string

Serialize PHP to PythonPickle format

Parameters
Name Type Description
$value mixed
$opts array
Returns
Type Description
string
methodpublicsetOption( string $name, mixed $value ) : \Zend_Serializer_Adapter_PythonPickle

Set an option

Parameters
Name Type Description
$name string
$value mixed
Returns
Type Description
\Zend_Serializer_Adapter_PythonPickle
Details
Link
Zend_Serializer_Adapter_AdapterAbstract::setOption()  
methodpublicunserialize( string $pickle, array $opts = array() ) : mixed

Unserialize from Python Pickle format to PHP

Parameters
Name Type Description
$pickle string
$opts array
Returns
Type Description
mixed
Throws
Exception Description
\Zend_Serializer_Exception on invalid Pickle string
Documentation was generated by DocBlox 0.15.1.