Open Monograph Press  3.3.0
PhpXmlRpc\Encoder Class Reference

Public Member Functions

 decode ($xmlrpcVal, $options=array())
 
 decodeXml ($xmlVal, $options=array())
 
 encode ($phpVal, $options=array())
 

Detailed Description

Definition at line 7 of file Encoder.php.

Member Function Documentation

◆ decode()

PhpXmlRpc\Encoder::decode (   $xmlrpcVal,
  $options = array() 
)

Takes an xmlrpc value in object format and translates it into native PHP types.

Works with xmlrpc requests objects as input, too.

Given proper options parameter, can rebuild generic php object instances (provided those have been encoded to xmlrpc format using a corresponding option in php_xmlrpc_encode()) PLEASE NOTE that rebuilding php objects involves calling their constructor function. This means that the remote communication end can decide which php code will get executed on your server, leaving the door possibly open to 'php-injection' style of attacks (provided you have some classes defined on your server that might wreak havoc if instances are built outside an appropriate context). Make sure you trust the remote server/client before eanbling this!

Author
Dan Libby (dan@l.nosp@m.ibby.nosp@m..com)
Parameters
Value | Request$xmlrpcVal
array$optionsif 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects; if 'dates_as_objects' is set xmlrpc datetimes are decoded as php DateTime objects (standard is
Returns
mixed

Definition at line 31 of file Encoder.php.

References PhpXmlRpc\Helper\Date\iso8601Decode().

◆ decodeXml()

PhpXmlRpc\Encoder::decodeXml (   $xmlVal,
  $options = array() 
)

Convert the xml representation of a method response, method request or single xmlrpc value into the appropriate object (a.k.a. deserialize).

Parameters
string$xmlVal
array$options
Returns
mixed false on error, or an instance of either Value, Request or Response

Definition at line 231 of file Encoder.php.

◆ encode()

PhpXmlRpc\Encoder::encode (   $phpVal,
  $options = array() 
)

Takes native php types and encodes them into xmlrpc PHP object format. It will not re-encode xmlrpc value objects.

Feature creep – could support more types via optional type argument (string => datetime support has been added, ??? => base64 not yet)

If given a proper options parameter, php object instances will be encoded into 'special' xmlrpc values, that can later be decoded into php objects by calling php_xmlrpc_decode() with a corresponding option

Author
Dan Libby (dan@l.nosp@m.ibby.nosp@m..com)
Parameters
mixed$phpValthe value to be converted into an xmlrpc value object
array$optionscan include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'
Returns
\PhpXmlrpc\Value

Definition at line 131 of file Encoder.php.


The documentation for this class was generated from the following file: